s3: smbd: Fix opening/creating :stream files on the root share directory.
authorJeremy Allison <jra@samba.org>
Wed, 16 Sep 2015 19:03:34 +0000 (12:03 -0700)
committerKarolin Seeger <kseeger@samba.org>
Mon, 5 Oct 2015 07:40:09 +0000 (09:40 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 74fd4f93efe92516fc507edf71a588660782879e)

source3/smbd/filename.c

index 32e736e64729222104d1a159ebf6e0f46d8ea193..d610cf1b6bb2bc347b4afed622a42b2e8beafbbd 100644 (file)
@@ -370,6 +370,29 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
                         */
                        *stream = '\0';
                        stream = tmp;
+
+                       if (smb_fname->base_name[0] == '\0') {
+                               /*
+                                * orig_name was just a stream name.
+                                * This is a stream on the root of
+                                * the share. Replace base_name with
+                                * a "."
+                                */
+                               smb_fname->base_name =
+                                       talloc_strdup(smb_fname, ".");
+                               if (smb_fname->base_name == NULL) {
+                                       status = NT_STATUS_NO_MEMORY;
+                                       goto err;
+                               }
+                               if (SMB_VFS_STAT(conn, smb_fname) != 0) {
+                                       status = map_nt_error_from_unix(errno);
+                                       goto err;
+                               }
+                               DEBUG(5, ("conversion finished %s -> %s\n",
+                                       orig_path,
+                                       smb_fname->base_name));
+                               goto done;
+                       }
                }
        }