From a4f1ecf50d9ab1e8c74a7543eeb3cca41df529fc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 19 Jul 2016 09:21:08 -0700 Subject: [PATCH] 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 (remove the SMB_FILENAME_POSIX_PATH flag) 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). BUG: https://bugzilla.samba.org/show_bug.cgi?id=12021 Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/smbd/close.c | 3 ++- source3/smbd/open.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 9d1f1a98afe..3c4b9b1f5b0 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -205,7 +205,8 @@ NTSTATUS delete_all_streams(connection_struct *conn, smb_fname->base_name, stream_info[i].name, NULL, - smb_fname->flags); + (smb_fname->flags & + ~SMB_FILENAME_POSIX_PATH)); if (smb_fname_stream == NULL) { DEBUG(0, ("talloc_aprintf failed\n")); diff --git a/source3/smbd/open.c b/source3/smbd/open.c index ab46fe0a20b..2ae6f835bbc 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3936,7 +3936,8 @@ static NTSTATUS open_streams_for_delete(connection_struct *conn, smb_fname->base_name, stream_info[i].name, NULL, - smb_fname->flags); + (smb_fname->flags & + ~SMB_FILENAME_POSIX_PATH)); if (smb_fname_cp == NULL) { status = NT_STATUS_NO_MEMORY; goto fail; -- 2.47.3