diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c index e8f41bea99d..b6ac11f4633 100644 --- a/source3/smbd/nttrans.c +++ b/source3/smbd/nttrans.c @@ -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: diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index b2dfdb21b1b..dafe448e3a8 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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, diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index a3110fb0a62..6dc00c750ef 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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)) { diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index f4bcd5ae2cb..d76e8fc8ffb 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -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: