]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: streams_depot: Allow "streams directory" outside of share path to work again.
authorJeremy Allison <jra@samba.org>
Mon, 19 Jul 2021 22:10:41 +0000 (15:10 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 19 Aug 2021 17:04:44 +0000 (17:04 +0000)
As we're dealing with absolute paths here, we just need
to temporarily replace the connectpath whilst enumerating
streams.

Remove knownfail file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14760

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <noel.power@suse.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Aug 19 17:04:44 UTC 2021 on sn-devel-184

selftest/knownfail.d/simpleserver_streams [deleted file]
source3/modules/vfs_streams_depot.c

diff --git a/selftest/knownfail.d/simpleserver_streams b/selftest/knownfail.d/simpleserver_streams
deleted file mode 100644 (file)
index 2b74129..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-^samba3.smb2.streams.names\(simpleserver\)
-^samba3.smb2.streams.io\(simpleserver\)
-^samba3.smb2.streams.names3\(simpleserver\)
-^samba3.smb2.streams.delete\(simpleserver\)
-^samba3.smb2.streams.zero-byte\(simpleserver\)
-^samba3.smb2.streams.sharemodes\(simpleserver\)
index d3b511d31328c0f5d0418e154138f46dbb4e7b23..973edeeda24c2a9aea8de78766bc071cc8bfff3b 100644 (file)
@@ -544,6 +544,8 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
                             void *private_data)
 {
        char *dirname;
+       char *rootdir = NULL;
+       char *orig_connectpath = NULL;
        struct smb_filename *dir_smb_fname = NULL;
        struct smb_Dir *dir_hnd = NULL;
        const char *dname = NULL;
@@ -576,8 +578,26 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
                return NT_STATUS_NO_MEMORY;
        }
 
+       /*
+        * For OpenDir to succeed if the stream rootdir is outside
+        * the share path, we must temporarily swap out the connect
+        * path for this share. We're dealing with absolute paths
+        * here so we don't care about chdir calls.
+        */
+       rootdir = stream_rootdir(handle, talloc_tos());
+       if (rootdir == NULL) {
+               TALLOC_FREE(dir_smb_fname);
+               TALLOC_FREE(dirname);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       orig_connectpath = handle->conn->connectpath;
+       handle->conn->connectpath = rootdir;
+
        dir_hnd = OpenDir(talloc_tos(), handle->conn, dir_smb_fname, NULL, 0);
        if (dir_hnd == NULL) {
+               handle->conn->connectpath = orig_connectpath;
+               TALLOC_FREE(rootdir);
                TALLOC_FREE(dir_smb_fname);
                TALLOC_FREE(dirname);
                return map_nt_error_from_unix(errno);
@@ -600,6 +620,9 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
                TALLOC_FREE(talloced);
        }
 
+       /* Restore the original connectpath. */
+       handle->conn->connectpath = orig_connectpath;
+       TALLOC_FREE(rootdir);
        TALLOC_FREE(dir_smb_fname);
        TALLOC_FREE(dir_hnd);