The Samba-Bugzilla – Attachment 10761 Details for
Bug 11104
SMB2/SMB3 close response does not include attributes when requested
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
git-am fix for 4.2.0
bug-11104-4.2 (text/plain), 6.24 KB, created by
Jeremy Allison
on 2015-02-20 20:05:00 UTC
(
hide
)
Description:
git-am fix for 4.2.0
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2015-02-20 20:05:00 UTC
Size:
6.24 KB
patch
obsolete
>From 5426968aa69167bcdd5716e25901825bd0e540de Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 19 Feb 2015 18:46:55 -0800 >Subject: [PATCH 1/3] s3: smbd: SMB2 close. Add utility function > setup_close_full_information() > >Not yet used. > >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 <jra@samba.org> >Reviewed-by: Steve French <sfrench@samba.org> >(cherry picked from commit 2ccfdf760e4adcf25d59c629c9d6d6b31a10a9f1) >--- > source3/smbd/smb2_close.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > >diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c >index 996ad5d..1a8c41a 100644 >--- a/source3/smbd/smb2_close.c >+++ b/source3/smbd/smb2_close.c >@@ -149,6 +149,48 @@ static void smbd_smb2_request_close_done(struct tevent_req *subreq) > } > } > >+static void setup_close_full_information(connection_struct *conn, >+ struct smb_filename *smb_fname, >+ bool posix_open, >+ struct timespec *out_creation_ts, >+ struct timespec *out_last_access_ts, >+ struct timespec *out_last_write_ts, >+ struct timespec *out_change_ts, >+ uint16_t *out_flags, >+ uint64_t *out_allocation_size, >+ uint64_t *out_end_of_file, >+ uint32_t *out_file_attributes) >+{ >+ int ret; >+ if (posix_open) { >+ ret = SMB_VFS_LSTAT(conn, smb_fname); >+ } else { >+ ret = SMB_VFS_STAT(conn, smb_fname); >+ } >+ if (ret != 0) { >+ return; >+ } >+ >+ *out_flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; >+ *out_file_attributes = dos_mode(conn, smb_fname); >+ *out_last_write_ts = smb_fname->st.st_ex_mtime; >+ *out_last_access_ts = smb_fname->st.st_ex_atime; >+ *out_creation_ts = get_create_timespec(conn, NULL, smb_fname); >+ *out_change_ts = get_change_timespec(conn, NULL, smb_fname); >+ >+ if (lp_dos_filetime_resolution(SNUM(conn))) { >+ dos_filetime_timespec(out_creation_ts); >+ dos_filetime_timespec(out_last_write_ts); >+ dos_filetime_timespec(out_last_access_ts); >+ dos_filetime_timespec(out_change_ts); >+ } >+ if (!(*out_file_attributes & FILE_ATTRIBUTE_DIRECTORY)) { >+ *out_end_of_file = get_file_size_stat(&smb_fname->st); >+ } >+ >+ *out_allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st); >+} >+ > static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, > struct files_struct *fsp, > uint16_t in_flags, >-- >1.9.1 > > >From bb18932a636aa96028ee5b484842942540f85b74 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 19 Feb 2015 18:49:03 -0800 >Subject: [PATCH 2/3] s3: smbd: SMB2 close. Call utility function > setup_close_full_information() > >Replaces existing inline code. > >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 <jra@samba.org> >Reviewed-by: Steve French <sfrench@samba.org> >(cherry picked from commit 4a8c6988e349a4f714f3052ebf3f96f801d3c11f) >--- > source3/smbd/smb2_close.c | 37 +++++++++++-------------------------- > 1 file changed, 11 insertions(+), 26 deletions(-) > >diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c >index 1a8c41a..86ae3dc 100644 >--- a/source3/smbd/smb2_close.c >+++ b/source3/smbd/smb2_close.c >@@ -245,32 +245,17 @@ static NTSTATUS smbd_smb2_close(struct smbd_smb2_request *req, > } > > if (in_flags & SMB2_CLOSE_FLAGS_FULL_INFORMATION) { >- int ret; >- if (posix_open) { >- ret = SMB_VFS_LSTAT(conn, smb_fname); >- } else { >- ret = SMB_VFS_STAT(conn, smb_fname); >- } >- if (ret == 0) { >- flags = SMB2_CLOSE_FLAGS_FULL_INFORMATION; >- dos_attrs = dos_mode(conn, smb_fname); >- *out_last_write_ts = smb_fname->st.st_ex_mtime; >- *out_last_access_ts = smb_fname->st.st_ex_atime; >- *out_creation_ts = get_create_timespec(conn, NULL, smb_fname); >- *out_change_ts = get_change_timespec(conn, NULL, smb_fname); >- >- if (lp_dos_filetime_resolution(SNUM(conn))) { >- dos_filetime_timespec(out_creation_ts); >- dos_filetime_timespec(out_last_write_ts); >- dos_filetime_timespec(out_last_access_ts); >- dos_filetime_timespec(out_change_ts); >- } >- if (!(dos_attrs & FILE_ATTRIBUTE_DIRECTORY)) { >- file_size = get_file_size_stat(&smb_fname->st); >- } >- >- allocation_size = SMB_VFS_GET_ALLOC_SIZE(conn, NULL, &smb_fname->st); >- } >+ 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); > } > > *out_flags = flags; >-- >1.9.1 > > >From 7c2771d2e7225e7ac23e963bc3e6d1d63537abba Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Thu, 19 Feb 2015 18:50:45 -0800 >Subject: [PATCH 3/3] 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 <jra@samba.org> >Reviewed-by: Steve French <sfrench@samba.org> > >Autobuild-User(master): Jeremy Allison <jra@samba.org> >Autobuild-Date(master): Fri Feb 20 20:54:18 CET 2015 on sn-devel-104 > >(cherry picked from commit a6008b2de7b2974073f38a1df88aacc27d3c6f57) >--- > source3/smbd/smb2_close.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > >diff --git a/source3/smbd/smb2_close.c b/source3/smbd/smb2_close.c >index 86ae3dc..e922e23 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", >-- >1.9.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
sfrench
:
review+
Actions:
View
Attachments on
bug 11104
:
10747
|
10748
|
10753
|
10757
|
10758
| 10761