]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: SMB1 rename_internals() can figure out the wildcard status of the paths...
authorJeremy Allison <jra@samba.org>
Tue, 29 Sep 2020 20:08:01 +0000 (13:08 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 30 Sep 2020 20:46:40 +0000 (20:46 +0000)
No need to pass them as parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/nttrans.c
source3/smbd/proto.h
source3/smbd/reply.c
source3/smbd/trans2.c

index e8f41bea99d66f6e1282a9e3d58ae749856822f2..b6ac11f4633c0776930351a925ed7d78370b8624 100644 (file)
@@ -1843,8 +1843,6 @@ void reply_ntrename(struct smb_request *req)
                                                dst_original_lcomp,
                                                attrs,
                                                false,
-                                               false, /* src_has_wcard */
-                                               dest_has_wcard,
                                                DELETE_ACCESS);
                        break;
                case RENAME_FLAG_HARD_LINK:
index b2dfdb21b1beb09d11190bd7ba28b741736ab663..dafe448e3a8a688c12ab45ed1c6a25dbf490545c 100644 (file)
@@ -1050,8 +1050,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        const char *dst_original_lcomp,
                        uint32_t attrs,
                        bool replace_if_exists,
-                       bool src_has_wild,
-                       bool dest_has_wild,
                        uint32_t access_mask);
 void reply_mv(struct smb_request *req);
 NTSTATUS copy_file(TALLOC_CTX *ctx,
index a3110fb0a62613d1bbaa8f103dad7f72d41bf041..6dc00c750efd381b81ccd2df807b4449d777b6d9 100644 (file)
@@ -7964,8 +7964,6 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                        const char *dst_original_lcomp,
                        uint32_t attrs,
                        bool replace_if_exists,
-                       bool src_has_wild,
-                       bool dest_has_wild,
                        uint32_t access_mask)
 {
        char *fname_src_dir = NULL;
@@ -7981,6 +7979,8 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
        bool posix_pathnames = (req != NULL && req->posix_pathnames);
        struct smb2_create_blobs *posx = NULL;
        int rc;
+       bool src_has_wild = false;
+       bool dest_has_wild = false;
 
        /*
         * Split the old name into directory and last component
@@ -7999,6 +7999,18 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                goto out;
        }
 
+       if (req != NULL && !req->posix_pathnames) {
+               /*
+                * Check the wildcard mask *before*
+                * unmangling. As mangling is done
+                * for names that can't be returned
+                * to Windows the unmangled name may
+                * contain Windows wildcard characters.
+                */
+               src_has_wild = ms_has_wild(fname_src_mask);
+               dest_has_wild = ms_has_wild(dst_original_lcomp);
+       }
+
        /*
         * We should only check the mangled cache
         * here if unix_convert failed. This means
@@ -8471,8 +8483,6 @@ void reply_mv(struct smb_request *req)
                                dst_original_lcomp,
                                attrs,
                                false,
-                               src_has_wcard,
-                               dest_has_wcard,
                                DELETE_ACCESS);
        if (!NT_STATUS_IS_OK(status)) {
                if (open_was_deferred(req->xconn, req->mid)) {
index f4bcd5ae2cb3cf1849c9d011a8a8d1c09b964bf9..d76e8fc8ffbc8755cc9d8f6f4018e79257b53d5b 100644 (file)
@@ -7501,8 +7501,6 @@ static NTSTATUS smb_file_rename_information(connection_struct *conn,
                                        dst_original_lcomp,
                                        0,
                                        overwrite,
-                                       false,
-                                       dest_has_wcard,
                                        FILE_WRITE_ATTRIBUTES);
        }
  out: