Ignore:
Timestamp:
Nov 29, 2012, 1:59:04 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/source3/smbd/reply.c

    r745 r751  
    17671767        }
    17681768
    1769         if (!map_open_params_to_ntcreate(smb_fname, deny_mode,
     1769        if (!map_open_params_to_ntcreate(smb_fname->base_name, deny_mode,
    17701770                                         OPENX_FILE_EXISTS_OPEN, &access_mask,
    17711771                                         &share_mode, &create_disposition,
     
    19421942        }
    19431943
    1944         if (!map_open_params_to_ntcreate(smb_fname, deny_mode, smb_ofun,
     1944        if (!map_open_params_to_ntcreate(smb_fname->base_name, deny_mode,
     1945                                         smb_ofun,
    19451946                                         &access_mask, &share_mode,
    19461947                                         &create_disposition,
     
    25412542
    25422543        /* The set is across all open files on this dev/inode pair. */
    2543         if (!set_delete_on_close(fsp, True, &conn->session_info->utok)) {
     2544        if (!set_delete_on_close(fsp, true,
     2545                                conn->session_info->security_token,
     2546                                &conn->session_info->utok)) {
    25442547                close_file(req, fsp, NORMAL_CLOSE);
    25452548                return NT_STATUS_ACCESS_DENIED;
     
    46304633        SSVAL(req->outbuf,smb_vwv4,nwritten>>16);
    46314634
    4632         if (nwritten < (ssize_t)numtowrite) {
    4633                 SCVAL(req->outbuf,smb_rcls,ERRHRD);
    4634                 SSVAL(req->outbuf,smb_err,ERRdiskfull);
    4635         }
    4636 
    46374635        DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n",
    46384636                fsp->fnum, (int)numtowrite, (int)nwritten));
     
    56555653        }
    56565654
    5657         if (!set_delete_on_close(fsp, true, &conn->session_info->utok)) {
     5655        if (!set_delete_on_close(fsp, true,
     5656                        conn->session_info->security_token,
     5657                        &conn->session_info->utok)) {
    56585658                close_file(req, fsp, ERROR_CLOSE);
    56595659                reply_nterror(req, NT_STATUS_ACCESS_DENIED);
     
    59365936
    59375937/****************************************************************************
     5938 Returns an error if the parent directory for a filename is open in an
     5939 incompatible way.
     5940****************************************************************************/
     5941
     5942static NTSTATUS parent_dirname_compatible_open(connection_struct *conn,
     5943                                        const struct smb_filename *smb_fname_dst_in)
     5944{
     5945        char *parent_dir = NULL;
     5946        struct smb_filename smb_fname_parent;
     5947        struct file_id id;
     5948        files_struct *fsp = NULL;
     5949        int ret;
     5950
     5951        if (!parent_dirname(talloc_tos(), smb_fname_dst_in->base_name,
     5952                        &parent_dir, NULL)) {
     5953                return NT_STATUS_NO_MEMORY;
     5954        }
     5955        ZERO_STRUCT(smb_fname_parent);
     5956        smb_fname_parent.base_name = parent_dir;
     5957
     5958        ret = SMB_VFS_LSTAT(conn, &smb_fname_parent);
     5959        if (ret == -1) {
     5960                return map_nt_error_from_unix(errno);
     5961        }
     5962
     5963        /*
     5964         * We're only checking on this smbd here, mostly good
     5965         * enough.. and will pass tests.
     5966         */
     5967
     5968        id = vfs_file_id_from_sbuf(conn, &smb_fname_parent.st);
     5969        for (fsp = file_find_di_first(conn->sconn, id); fsp;
     5970                        fsp = file_find_di_next(fsp)) {
     5971                if (fsp->access_mask & DELETE_ACCESS) {
     5972                        return NT_STATUS_SHARING_VIOLATION;
     5973                }
     5974        }
     5975        return NT_STATUS_OK;
     5976}
     5977
     5978/****************************************************************************
    59385979 Rename an open file - given an fsp.
    59395980****************************************************************************/
     
    59596000
    59606001        status = check_name(conn, smb_fname_dst_in->base_name);
     6002        if (!NT_STATUS_IS_OK(status)) {
     6003                return status;
     6004        }
     6005
     6006        status = parent_dirname_compatible_open(conn, smb_fname_dst_in);
    59616007        if (!NT_STATUS_IS_OK(status)) {
    59626008                return status;
     
    65696615        struct smb_filename *smb_fname_src = NULL;
    65706616        struct smb_filename *smb_fname_dst = NULL;
     6617        uint32_t src_ucf_flags = lp_posix_pathnames() ? UCF_UNIX_NAME_LOOKUP : UCF_COND_ALLOW_WCARD_LCOMP;
     6618        uint32_t dst_ucf_flags = UCF_SAVE_LCOMP | (lp_posix_pathnames() ? 0 : UCF_COND_ALLOW_WCARD_LCOMP);
    65716619        bool stream_rename = false;
    65726620
     
    66116659                                  req->flags2 & FLAGS2_DFS_PATHNAMES,
    66126660                                  name,
    6613                                   UCF_COND_ALLOW_WCARD_LCOMP,
     6661                                  src_ucf_flags,
    66146662                                  &src_has_wcard,
    66156663                                  &smb_fname_src);
     
    66296677                                  req->flags2 & FLAGS2_DFS_PATHNAMES,
    66306678                                  newname,
    6631                                   UCF_COND_ALLOW_WCARD_LCOMP | UCF_SAVE_LCOMP,
     6679                                  dst_ucf_flags,
    66326680                                  &dest_has_wcard,
    66336681                                  &smb_fname_dst);
     
    67406788                new_create_disposition = FILE_OPEN;
    67416789        } else {
    6742                 if (!map_open_params_to_ntcreate(smb_fname_dst_tmp, 0, ofun,
     6790                if (!map_open_params_to_ntcreate(smb_fname_dst_tmp->base_name,
     6791                                                 0, ofun,
    67436792                                                 NULL, NULL,
    67446793                                                 &new_create_disposition,
Note: See TracChangeset for help on using the changeset viewer.