Changeset 751 for trunk/server/source3/smbd/reply.c
- Timestamp:
- Nov 29, 2012, 1:59:04 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/source3/smbd/reply.c
r745 r751 1767 1767 } 1768 1768 1769 if (!map_open_params_to_ntcreate(smb_fname , deny_mode,1769 if (!map_open_params_to_ntcreate(smb_fname->base_name, deny_mode, 1770 1770 OPENX_FILE_EXISTS_OPEN, &access_mask, 1771 1771 &share_mode, &create_disposition, … … 1942 1942 } 1943 1943 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, 1945 1946 &access_mask, &share_mode, 1946 1947 &create_disposition, … … 2541 2542 2542 2543 /* 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)) { 2544 2547 close_file(req, fsp, NORMAL_CLOSE); 2545 2548 return NT_STATUS_ACCESS_DENIED; … … 4630 4633 SSVAL(req->outbuf,smb_vwv4,nwritten>>16); 4631 4634 4632 if (nwritten < (ssize_t)numtowrite) {4633 SCVAL(req->outbuf,smb_rcls,ERRHRD);4634 SSVAL(req->outbuf,smb_err,ERRdiskfull);4635 }4636 4637 4635 DEBUG(3,("writeX fnum=%d num=%d wrote=%d\n", 4638 4636 fsp->fnum, (int)numtowrite, (int)nwritten)); … … 5655 5653 } 5656 5654 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)) { 5658 5658 close_file(req, fsp, ERROR_CLOSE); 5659 5659 reply_nterror(req, NT_STATUS_ACCESS_DENIED); … … 5936 5936 5937 5937 /**************************************************************************** 5938 Returns an error if the parent directory for a filename is open in an 5939 incompatible way. 5940 ****************************************************************************/ 5941 5942 static 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 /**************************************************************************** 5938 5979 Rename an open file - given an fsp. 5939 5980 ****************************************************************************/ … … 5959 6000 5960 6001 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); 5961 6007 if (!NT_STATUS_IS_OK(status)) { 5962 6008 return status; … … 6569 6615 struct smb_filename *smb_fname_src = NULL; 6570 6616 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); 6571 6619 bool stream_rename = false; 6572 6620 … … 6611 6659 req->flags2 & FLAGS2_DFS_PATHNAMES, 6612 6660 name, 6613 UCF_COND_ALLOW_WCARD_LCOMP,6661 src_ucf_flags, 6614 6662 &src_has_wcard, 6615 6663 &smb_fname_src); … … 6629 6677 req->flags2 & FLAGS2_DFS_PATHNAMES, 6630 6678 newname, 6631 UCF_COND_ALLOW_WCARD_LCOMP | UCF_SAVE_LCOMP,6679 dst_ucf_flags, 6632 6680 &dest_has_wcard, 6633 6681 &smb_fname_dst); … … 6740 6788 new_create_disposition = FILE_OPEN; 6741 6789 } 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, 6743 6792 NULL, NULL, 6744 6793 &new_create_disposition,
Note:
See TracChangeset
for help on using the changeset viewer.