s3: smbd: Fix delete operations enumerating streams inside a file. This must always...
authorJeremy Allison <jra@samba.org>
Tue, 19 Jul 2016 16:21:08 +0000 (09:21 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 19 Jul 2016 23:38:28 +0000 (01:38 +0200)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/close.c
source3/smbd/open.c

index 9d1f1a98afefd17ed02daeb28be297fae702ebf8..3c4b9b1f5b08801e5aa6e06513ad0c8f9930baf6 100644 (file)
@@ -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"));
index ab46fe0a20b5b50b0235ed118d3996352013d53b..2ae6f835bbcde2fd52efd2754616f9cdf389aaf2 100644 (file)
@@ -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;