]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Allow extract_snapshot_token() to cope with MSDFS paths.
authorJeremy Allison <jra@samba.org>
Wed, 3 Aug 2022 16:20:36 +0000 (09:20 -0700)
committerJeremy Allison <jra@samba.org>
Thu, 4 Aug 2022 17:09:31 +0000 (17:09 +0000)
"raw" MSDFS paths are passed here as \server\share\path.

find_snapshot_token() only looks for a '/' as a separator
in SMB1 shapshot paths.

Allow extract_snapshot_token() to cope with SMB1 MSDFS paths by
converting in place, looking for the @GMT token with a '/'
separator via find_snapshot_token(), and then converting back.

Note, this a temporary measure until we handle DFS paths better
and will be removed in the next patchset.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/filename.c

index de29942bde0acf67ed59f713fc485fb4aac5b8f6..35c8e3a5363454ab4c8f617f05d8554ada27f06a 100644 (file)
@@ -306,8 +306,22 @@ bool extract_snapshot_token(char *fname, uint32_t ucf_flags, NTTIME *twrp)
        const char *next = NULL;
        size_t remaining;
        bool found;
+       bool posix_path = (ucf_flags & UCF_POSIX_PATHNAMES);
+       bool msdfs_path = (ucf_flags & UCF_DFS_PATHNAME);
 
+       if (msdfs_path && !posix_path) {
+               /*
+                * A raw (non-POSIX) MSDFS path looks like \server\share\path.
+                * find_snapshot_token only looks for '/' separators.
+                * Convert the separator characters in place.
+                */
+               string_replace(fname, '\\', '/');
+       }
        found = find_snapshot_token(fname, &start, &next, twrp);
+       if (msdfs_path && !posix_path) {
+               /* Put the original separators back. */
+               string_replace(fname, '/', '\\');
+       }
        if (!found) {
                return false;
        }