From: Jeremy Allison Date: Fri, 20 Feb 2015 02:50:45 +0000 (-0800) Subject: s3: smbd: SMB2 close. If a file has delete on close, store the return info before... X-Git-Tag: samba-4.2.0rc5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bba7796a7326a4b4fafcf3b36fe4a2c44eb42a8d;p=thirdparty%2Fsamba.git s3: smbd: SMB2 close. If a file has delete on close, store the return info before deleting. If we delete the file on close, the stat after the close will fail so we fail to return the attributes requested. Bug 11104 - SMB2/SMB3 close response does not include attributes when requested. https://bugzilla.samba.org/show_bug.cgi?id=11104 Signed-off-by: Jeremy Allison Reviewed-by: Steve French Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Fri Feb 20 20:54:18 CET 2015 on sn-devel-104 (cherry picked from commit a6008b2de7b2974073f38a1df88aacc27d3c6f57) Autobuild-User(v4-2-test): Karolin Seeger Autobuild-Date(v4-2-test): Sun Feb 22 16:41:21 CET 2015 on sn-devel-104 --- diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c index 755a4b69f34..ed53e1be0a7 100644 --- a/source3/smbd/smb2_close.c +++ b/source3/smbd/smb2_close.c @@ -237,6 +237,26 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, return NT_STATUS_NO_MEMORY; } + if ((in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) && + (fsp->initial_delete_on_close || fsp->delete_on_close)) { + /* + * We might be deleting the file. Ensure we + * return valid data from before the file got + * removed. + */ + setup_close_full_information(conn, + smb_fname, + posix_open, + out_creation_ts, + out_last_access_ts, + out_last_write_ts, + out_change_ts, + &flags, + &allocation_size, + &file_size, + &dos_attrs); + } + status = close_file(smbreq, fsp, NORMAL_CLOSE); if (!NT_STATUS_IS_OK(status)) { DEBUG(5,("smbd_smb2_close: close_file[%s]: %s\n",