]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Fix SMB1 reply_mv() to handle wildcards.
authorJeremy Allison <jra@samba.org>
Mon, 5 Oct 2020 19:16:32 +0000 (12:16 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 8 Oct 2020 16:29:27 +0000 (16:29 +0000)
Pass in the original source last component to rename_internals()
from reply_mv().

Change the wildcard detection in rename_internals() to
look at the correct thing for the source path.

This is now correctly set only from the unmangled last component
of the source path sent to reply_mv().

We now pass:

Samba3.smbtorture_s3.crypt_client.SMB1-WILD-MANGLE-RENAME(nt4_dc_smb1)
samba3.smbtorture_s3.plain.SMB1-WILD-MANGLE-RENAME(fileserver_smb1)

so remove the knownfail.

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): Thu Oct  8 16:29:27 UTC 2020 on sn-devel-184

selftest/knownfail.d/smb1-wild-mangle-rename [deleted file]
source3/smbd/reply.c

diff --git a/selftest/knownfail.d/smb1-wild-mangle-rename b/selftest/knownfail.d/smb1-wild-mangle-rename
deleted file mode 100644 (file)
index 8f1c036..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-# Check SMB1 wildcard demangle
-^samba3.smbtorture_s3.plain.SMB1-WILD-MANGLE-RENAME.smbtorture\(fileserver_smb1\)
-^samba3.smbtorture_s3.crypt_client.SMB1-WILD-MANGLE-RENAME.smbtorture\(nt4_dc_smb1\)
index 43bf9bb79945299b9ebe1c124adf12ad733164bb..51f95f565c0ace29fadcb37a99952f1cc712a029 100644 (file)
@@ -7909,7 +7909,9 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                 * to Windows the unmangled name may
                 * contain Windows wildcard characters.
                 */
-               src_has_wild = ms_has_wild(fname_src_mask);
+               if (src_original_lcomp != NULL) {
+                       src_has_wild = ms_has_wild(src_original_lcomp);
+               }
                dest_has_wild = ms_has_wild(dst_original_lcomp);
        }
 
@@ -8264,6 +8266,7 @@ void reply_mv(struct smb_request *req)
        NTSTATUS status;
        TALLOC_CTX *ctx = talloc_tos();
        struct smb_filename *smb_fname_src = NULL;
+       const char *src_original_lcomp = NULL;
        struct smb_filename *smb_fname_dst = NULL;
        const char *dst_original_lcomp = NULL;
        uint32_t src_ucf_flags = ucf_flags_from_smb_request(req) |
@@ -8329,6 +8332,16 @@ void reply_mv(struct smb_request *req)
                goto out;
        }
 
+       /* Get the last component of the source for rename_internals(). */
+       src_original_lcomp = get_original_lcomp(ctx,
+                                       conn,
+                                       name,
+                                       dst_ucf_flags);
+       if (src_original_lcomp == NULL) {
+               reply_nterror(req, NT_STATUS_NO_MEMORY);
+               goto out;
+       }
+
        status = filename_convert(ctx,
                                  conn,
                                  newname,
@@ -8375,7 +8388,7 @@ void reply_mv(struct smb_request *req)
                                conn,
                                req,
                                smb_fname_src,
-                               NULL,
+                               src_original_lcomp,
                                smb_fname_dst,
                                dst_original_lcomp,
                                attrs,