From: Jeremy Allison Date: Wed, 20 Jul 2016 18:34:48 +0000 (-0700) Subject: s3: smbd: Fix delete operations enumerating streams inside a file. This must always... X-Git-Tag: samba-4.3.12~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f02671a4cc7fabedfbeb7dad856eecf619d389d2;p=thirdparty%2Fsamba.git 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 --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 1cb546055d0..66840aed5f3 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