]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: reply_copy(), is_visible_file() -> is_visible_fsp().
authorJeremy Allison <jra@samba.org>
Thu, 3 Jun 2021 19:38:18 +0000 (12:38 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:30 +0000 (13:14 +0000)
Offtopic, the function reply_copy() is insane and should be removed.

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

index 73e9146a969b5d4472883c85c29eb13c7366a5a5..7efccdeadf92708358de7967103d52c9aff6734f 100644 (file)
@@ -8972,15 +8972,6 @@ void reply_copy(struct smb_request *req)
                                continue;
                        }
 
-                       if (!is_visible_file(conn,
-                                       dir_hnd,
-                                       dname,
-                                       &smb_fname_src->st,
-                                       false)) {
-                               TALLOC_FREE(talloced);
-                               continue;
-                       }
-
                        if(!mask_match(dname, fname_src_mask,
                                       conn->case_sensitive)) {
                                TALLOC_FREE(talloced);
@@ -9025,6 +9016,23 @@ void reply_copy(struct smb_request *req)
                        TALLOC_FREE(smb_fname_dst->base_name);
                        smb_fname_dst->base_name = destname;
 
+                       ZERO_STRUCT(smb_fname_src->st);
+                       vfs_stat(conn, smb_fname_src);
+
+                       status = openat_pathref_fsp(conn->cwd_fsp,
+                                                   smb_fname_src);
+                       if (!NT_STATUS_IS_OK(status)) {
+                               DBG_INFO("openat_pathref_fsp [%s] failed: %s\n",
+                                       smb_fname_str_dbg(smb_fname_src),
+                                       nt_errstr(status));
+                               break;
+                       }
+
+                       if (!is_visible_fsp(smb_fname_src->fsp, false)) {
+                               TALLOC_FREE(talloced);
+                               continue;
+                       }
+
                        status = check_name(conn, smb_fname_src);
                        if (!NT_STATUS_IS_OK(status)) {
                                TALLOC_FREE(dir_hnd);