Ignore:
Timestamp:
Aug 21, 2007, 11:34:46 AM (18 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.25c level

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/smbd/trans2.c

    r39 r62  
    878878                oplock_request,
    879879                &smb_action, &fsp);
    880      
     880
    881881        if (!NT_STATUS_IS_OK(status)) {
    882882                if (open_was_deferred(SVAL(inbuf,smb_mid))) {
     
    884884                        return -1;
    885885                }
    886                 return ERROR_NT(status);
     886                return ERROR_OPEN(status);
    887887        }
    888888
     
    20112011                   path or an invalid name). Catch this as the resume name is only compared, never used in
    20122012                   a file access. JRA. */
    2013                 if (NT_STATUS_EQUAL(ntstatus,NT_STATUS_OBJECT_PATH_SYNTAX_BAD)) {
    2014                         pstrcpy(resume_name, "..");
    2015                 } else if (NT_STATUS_EQUAL(ntstatus,NT_STATUS_OBJECT_NAME_INVALID)) {
    2016                         pstrcpy(resume_name, ".");
    2017                 } else {
     2013                srvstr_pull(inbuf, resume_name, params+12,
     2014                                        sizeof(resume_name), total_params - 12,
     2015                                        STR_TERMINATE);
     2016
     2017                if (!(ISDOT(resume_name) || ISDOTDOT(resume_name))) {
    20182018                        return ERROR_NT(ntstatus);
    20192019                }
     
    48574857        }
    48584858
    4859         if(allocation_size == get_file_size(*psbuf)) {
    4860                 return NT_STATUS_OK;
    4861         }
    4862  
    48634859        DEBUG(10,("smb_set_file_allocation_info: file %s : setting new allocation size to %.0f\n",
    48644860                        fname, (double)allocation_size ));
    4865  
     4861
    48664862        if (fsp && fsp->fh->fd != -1) {
    48674863                /* Open file handle. */
    4868                 if (vfs_allocate_file_space(fsp, allocation_size) == -1) {
    4869                         return map_nt_error_from_unix(errno);
     4864                /* Only change if needed. */
     4865                if (allocation_size != get_file_size(*psbuf)) {
     4866                        if (vfs_allocate_file_space(fsp, allocation_size) == -1) {
     4867                                return map_nt_error_from_unix(errno);
     4868                        }
     4869                }
     4870                /* But always update the time. */
     4871                if (null_timespec(fsp->pending_modtime)) {
     4872                        /*
     4873                         * This is equivalent to a write. Ensure it's seen immediately
     4874                         * if there are no pending writes.
     4875                         */
     4876                        set_filetime(fsp->conn, fsp->fsp_name, timespec_current());
    48704877                }
    48714878                return NT_STATUS_OK;
     
    48824889                                FORCE_OPLOCK_BREAK_TO_NONE,
    48834890                                NULL, &new_fsp);
    4884  
     4891
    48854892        if (!NT_STATUS_IS_OK(status)) {
    48864893                /* NB. We check for open_was_deferred in the caller. */
    48874894                return status;
    48884895        }
    4889         if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
    4890                 status = map_nt_error_from_unix(errno);
    4891                 close_file(new_fsp,NORMAL_CLOSE);
    4892                 return status;
    4893         }
     4896
     4897        /* Only change if needed. */
     4898        if (allocation_size != get_file_size(*psbuf)) {
     4899                if (vfs_allocate_file_space(new_fsp, allocation_size) == -1) {
     4900                        status = map_nt_error_from_unix(errno);
     4901                        close_file(new_fsp,NORMAL_CLOSE);
     4902                        return status;
     4903                }
     4904        }
     4905
     4906        /* Changing the allocation size should set the last mod time. */
     4907        /* Don't need to call set_filetime as this will be flushed on
     4908         * close. */
     4909
     4910        fsp_set_pending_modtime(new_fsp, timespec_current());
    48944911
    48954912        close_file(new_fsp,NORMAL_CLOSE);
     
    55375554        files_struct *fsp = NULL;
    55385555        uint16 flags = 0;
     5556        char del = 1;
    55395557        int info = 0;
     5558        int i;
     5559        struct share_mode_lock *lck = NULL;
    55405560
    55415561        if (total_data < 2) {
     
    55655585                                        FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
    55665586                                        FILE_OPEN,
    5567                                         FILE_DELETE_ON_CLOSE,
     5587                                        0,
    55685588                                        FILE_FLAG_POSIX_SEMANTICS|0777,
    5569                                         &info,                         
     5589                                        &info,
    55705590                                        &fsp);
    55715591        } else {
    5572                 char del = 1;
    55735592
    55745593                status = open_file_ntcreate(conn,
     
    55835602                                &info,
    55845603                                &fsp);
    5585                 /*
    5586                  * For file opens we must set the delete on close
    5587                  * after the open.
    5588                  */
    5589 
    5590                 if (!NT_STATUS_IS_OK(status)) {
    5591                         return status;
    5592                 }
    5593 
    5594                 status = smb_set_file_disposition_info(conn,
    5595                                                         &del,
    5596                                                         1,
    5597                                                         fsp,
    5598                                                         fname,
    5599                                                         psbuf);
    56005604        }
    56015605
     
    56035607                return status;
    56045608        }
     5609
     5610        /*
     5611         * Don't lie to client. If we can't really delete due to
     5612         * non-POSIX opens return SHARING_VIOLATION.
     5613         */
     5614
     5615        lck = get_share_mode_lock(NULL, fsp->dev, fsp->inode, NULL, NULL);
     5616        if (lck == NULL) {
     5617                DEBUG(0, ("smb_posix_unlink: Could not get share mode "
     5618                        "lock for file %s\n", fsp->fsp_name));
     5619                close_file(fsp, NORMAL_CLOSE);
     5620                return NT_STATUS_INVALID_PARAMETER;
     5621        }
     5622
     5623        /*
     5624         * See if others still have the file open. If this is the case, then
     5625         * don't delete. If all opens are POSIX delete we can set the delete
     5626         * on close disposition.
     5627         */
     5628        for (i=0; i<lck->num_share_modes; i++) {
     5629                struct share_mode_entry *e = &lck->share_modes[i];
     5630                if (is_valid_share_mode_entry(e)) {
     5631                        if (e->flags & SHARE_MODE_FLAG_POSIX_OPEN) {
     5632                                continue;
     5633                        }
     5634                        /* Fail with sharing violation. */
     5635                        close_file(fsp, NORMAL_CLOSE);
     5636                        TALLOC_FREE(lck);
     5637                        return NT_STATUS_SHARING_VIOLATION;
     5638                }
     5639        }
     5640
     5641        /*
     5642         * Set the delete on close.
     5643         */
     5644        status = smb_set_file_disposition_info(conn,
     5645                                                &del,
     5646                                                1,
     5647                                                fsp,
     5648                                                fname,
     5649                                                psbuf);
     5650
     5651        if (!NT_STATUS_IS_OK(status)) {
     5652                close_file(fsp, NORMAL_CLOSE);
     5653                TALLOC_FREE(lck);
     5654                return status;
     5655        }
     5656        TALLOC_FREE(lck);
    56055657        return close_file(fsp, NORMAL_CLOSE);
    56065658}
     
    59976049                if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
    59986050                        return ERROR_BOTH(NT_STATUS_PATH_NOT_COVERED, ERRSRV, ERRbadpath);
     6051                }
     6052                if (info_level == SMB_POSIX_PATH_OPEN) {
     6053                        return ERROR_OPEN(status);
    59996054                }
    60006055                return ERROR_NT(status);
Note: See TracChangeset for help on using the changeset viewer.