The Samba-Bugzilla – Attachment 12282 Details for
Bug 12021
smbd Crashing (Signal 4) on File Delete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.4.x, 4.3.x.
12021-4.x (text/plain), 5.60 KB, created by
Jeremy Allison
on 2016-07-20 19:02:50 UTC
(
hide
)
Description:
Patch for 4.4.x, 4.3.x.
Filename:
MIME Type:
Creator:
Jeremy Allison
Created:
2016-07-20 19:02:50 UTC
Size:
5.60 KB
patch
obsolete
>From a237998cbd705186fd09cf82608d27c57603e2d8 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 20 Jul 2016 11:25:20 -0700 >Subject: [PATCH 1/2] s3: smbd: Change lp_set_posix_pathnames() to take a > newval parameter and return the old one. > >Currently only used in one place, but we'll need to use it to >temporarily change pathname processing to fix bug 12021. > >This (hack) is only needed for 4.4.x and below, it is fixed >correctly in 4.5.x. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12021 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/include/proto.h | 2 +- > source3/param/loadparm.c | 9 +++++---- > source3/smbd/trans2.c | 2 +- > 3 files changed, 7 insertions(+), 6 deletions(-) > >diff --git a/source3/include/proto.h b/source3/include/proto.h >index 0bd0c80..62cd257 100644 >--- a/source3/include/proto.h >+++ b/source3/include/proto.h >@@ -1020,7 +1020,7 @@ bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state); > void set_use_sendfile(int snum, bool val); > void lp_set_mangling_method(const char *new_method); > bool lp_posix_pathnames(void); >-void lp_set_posix_pathnames(void); >+bool lp_set_posix_pathnames(bool newval); > enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp); > void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val); > int lp_min_receive_file_size(void); >diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c >index 2ad1c6f..c40e478 100644 >--- a/source3/param/loadparm.c >+++ b/source3/param/loadparm.c >@@ -4337,13 +4337,14 @@ bool lp_posix_pathnames(void) > } > > /******************************************************************* >- Change everything needed to ensure POSIX pathname processing (currently >- not much). >+ Set posix pathnames to new value. Returns old value. > ********************************************************************/ > >-void lp_set_posix_pathnames(void) >+bool lp_set_posix_pathnames(bool newval) > { >- posix_pathnames = true; >+ bool oldval = posix_pathnames; >+ posix_pathnames = newval; >+ return oldval; > } > > /******************************************************************* >diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c >index 1780d6f..7354bba 100644 >--- a/source3/smbd/trans2.c >+++ b/source3/smbd/trans2.c >@@ -4152,7 +4152,7 @@ static void call_trans2setfsinfo(connection_struct *conn, > > /* Here is where we must switch to posix pathname processing... */ > if (xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) { >- lp_set_posix_pathnames(); >+ (void)lp_set_posix_pathnames(true); > mangle_change_to_posix(); > } > >-- >2.8.0.rc3.226.g39d4020 > > >From 883b4af8ffeffd79e51ac2a697b0d19ccfc4ec25 Mon Sep 17 00:00:00 2001 >From: Jeremy Allison <jra@samba.org> >Date: Wed, 20 Jul 2016 11:34:48 -0700 >Subject: [PATCH 2/2] s3: smbd: Fix delete operations enumerating streams > inside a file. This must always be done as a Windows operation. > >When using UNIX extensions to delete a file containing streams, >the open for delete and close operations need to enumerate the >contained streams and do CREATE and UNLINK operations on the >stream names. These must always be done as Windows operations >(use lp_set_posix_pathnames(false) to flip the processing) as >the stream names are Windows paths. > >Without this the create operation under the unlink will >recurse and cause the client to time out (or a server crash). > >This (hack) is only needed for 4.4.x and below, it is fixed >correctly in 4.5.x. > >BUG: https://bugzilla.samba.org/show_bug.cgi?id=12021 > >Signed-off-by: Jeremy Allison <jra@samba.org> >--- > source3/smbd/close.c | 10 ++++++++++ > source3/smbd/open.c | 10 ++++++++++ > 2 files changed, 20 insertions(+) > >diff --git a/source3/smbd/close.c b/source3/smbd/close.c >index 3ab04b7..271885e 100644 >--- a/source3/smbd/close.c >+++ b/source3/smbd/close.c >@@ -168,6 +168,7 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) > unsigned int num_streams = 0; > TALLOC_CTX *frame = talloc_stackframe(); > NTSTATUS status; >+ bool saved_posix_pathnames; > > status = vfs_streaminfo(conn, NULL, fname, talloc_tos(), > &num_streams, &stream_info); >@@ -192,6 +193,13 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) > return NT_STATUS_OK; > } > >+ /* >+ * Any stream names *must* be treated as Windows >+ * pathnames, even if we're using UNIX extensions. >+ */ >+ >+ saved_posix_pathnames = lp_set_posix_pathnames(false); >+ > for (i=0; i<num_streams; i++) { > int res; > struct smb_filename *smb_fname_stream; >@@ -223,6 +231,8 @@ NTSTATUS delete_all_streams(connection_struct *conn, const char *fname) > } > > fail: >+ >+ (void)lp_set_posix_pathnames(saved_posix_pathnames); > TALLOC_FREE(frame); > return status; > } >diff --git a/source3/smbd/open.c b/source3/smbd/open.c >index 2d5f8d7..5935ff5 100644 >--- a/source3/smbd/open.c >+++ b/source3/smbd/open.c >@@ -3871,6 +3871,7 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, > unsigned int num_streams = 0; > TALLOC_CTX *frame = talloc_stackframe(); > NTSTATUS status; >+ bool saved_posix_pathnames; > > status = vfs_streaminfo(conn, NULL, fname, talloc_tos(), > &num_streams, &stream_info); >@@ -3903,6 +3904,13 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, > goto fail; > } > >+ /* >+ * Any stream names *must* be treated as Windows >+ * pathnames, even if we're using UNIX extensions. >+ */ >+ >+ saved_posix_pathnames = lp_set_posix_pathnames(false); >+ > for (i=0; i<num_streams; i++) { > struct smb_filename *smb_fname; > >@@ -3970,6 +3978,8 @@ NTSTATUS open_streams_for_delete(connection_struct *conn, > } > > fail: >+ >+ (void)lp_set_posix_pathnames(saved_posix_pathnames); > TALLOC_FREE(frame); > return status; > } >-- >2.8.0.rc3.226.g39d4020 >
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:
slow
:
review+
jra
:
review?
(
obnox
)
Actions:
View
Attachments on
bug 12021
:
12270
|
12273
|
12274
|
12281
| 12282 |
12284