]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Fix parent_pathref() to cope with symlink parents.
authorJeremy Allison <jra@samba.org>
Tue, 6 Apr 2021 18:53:40 +0000 (11:53 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 7 Apr 2021 15:39:45 +0000 (15:39 +0000)
We know that the parent name must
exist, and the name has been canonicalized
even if this was a POSIX pathname.
Ensure that we follow symlinks for
the parent. See the torture test
POSIX-SYMLINK-PARENT for details.

Remove knownfail entry.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Wed Apr  7 15:39:45 UTC 2021 on sn-devel-184

selftest/knownfail.d/symlink_parent [deleted file]
source3/smbd/files.c

diff --git a/selftest/knownfail.d/symlink_parent b/selftest/knownfail.d/symlink_parent
deleted file mode 100644 (file)
index 752bab9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-^samba3.smbtorture_s3.plain.*POSIX-SYMLINK-PARENT
-^samba3.smbtorture_s3.crypt.*POSIX-SYMLINK-PARENT
index 213d069a5f4ae3637db3a3cbdc47246a6e055f77..548004d33c60c434fb30a4f3f29038f773bab5b0 100644 (file)
@@ -703,6 +703,16 @@ NTSTATUS parent_pathref(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
+       /*
+        * We know that the parent name must
+        * exist, and the name has been canonicalized
+        * even if this was a POSIX pathname.
+        * Ensure that we follow symlinks for
+        * the parent. See the torture test
+        * POSIX-SYMLINK-PARENT for details.
+        */
+       parent->flags &= ~SMB_FILENAME_POSIX_PATH;
+
        ret = vfs_stat(dirfsp->conn, parent);
        if (ret != 0) {
                TALLOC_FREE(parent);