From 6fbaa6ccc4dbcdab66ff2f2334c77dbb919c971b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Sep 2015 12:42:46 -0700 Subject: [PATCH 1/3] s3: smbd: Remove unused parameter from build_stream_path(). Signed-off-by: Jeremy Allison --- source3/smbd/filename.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index 6899d2a..e2c3fe4 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -32,7 +32,6 @@ static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, connection_struct *conn, - const char *orig_path, struct smb_filename *smb_fname); /**************************************************************************** @@ -981,7 +980,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx, smb_fname->stream_name = stream; /* Check path now that the base_name has been converted. */ - status = build_stream_path(ctx, conn, orig_path, smb_fname); + status = build_stream_path(ctx, conn, smb_fname); if (!NT_STATUS_IS_OK(status)) { goto fail; } @@ -1233,7 +1232,6 @@ int get_real_filename(connection_struct *conn, const char *path, static NTSTATUS build_stream_path(TALLOC_CTX *mem_ctx, connection_struct *conn, - const char *orig_path, struct smb_filename *smb_fname) { NTSTATUS status; -- 2.6.0.rc0.131.gf624c3d From afc06168b135d46bec45f5d8d493867bbef4156b Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Sep 2015 12:03:34 -0700 Subject: [PATCH 2/3] s3: smbd: Fix opening/creating :stream files on the root share directory. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522 Signed-off-by: Jeremy Allison --- source3/smbd/filename.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c index e2c3fe4..e6eca492 100644 --- a/source3/smbd/filename.c +++ b/source3/smbd/filename.c @@ -370,6 +370,28 @@ 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\n", + smb_fname->base_name)); + goto done; + } } } -- 2.6.0.rc0.131.gf624c3d From d873ca8d0cb0d8cb8e9225fecfaca11c23b348ce Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 16 Sep 2015 16:12:15 -0700 Subject: [PATCH 3/3] s3: tests: smbclient test to ensure we can create and see a :foobar stream on the top level directory in a share. Regression test for: BUG: https://bugzilla.samba.org/show_bug.cgi?id=11522 Signed-off-by: Jeremy Allison --- source3/script/tests/test_smbclient_s3.sh | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh index 69c7452..be116bd 100755 --- a/source3/script/tests/test_smbclient_s3.sh +++ b/source3/script/tests/test_smbclient_s3.sh @@ -971,6 +971,37 @@ EOF fi } +# Test creating a stream on the root of the share directory filname - :foobar +test_toplevel_stream() +{ + tmpfile=$PREFIX/smbclient_interactive_prompt_commands + cat > $tmpfile <