s3: smbd: Change is_visible_file() to take a directory handle not a name.
authorJeremy Allison <jra@samba.org>
Wed, 29 Apr 2020 21:43:50 +0000 (14:43 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 30 Apr 2020 07:33:41 +0000 (07:33 +0000)
No change in functionality as the name is
easily retrieved from the directory handle
(it's always the name we opened the directory with)
and this will allow us to use the directory handle
fsp later.

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

index 42aedff6a785367906a8ee59e634306eab7005c4..d0988afcec0fea55c9da47fb3c7446b0d0967fef 100644 (file)
@@ -833,7 +833,7 @@ bool recursive_rmdir(TALLOC_CTX *ctx,
                }
 
                if (!is_visible_file(conn,
-                                       smb_dname,
+                                       dir_hnd,
                                        dname,
                                        &st,
                                        false)) {
@@ -973,7 +973,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, files_struct *fsp)
                                continue;
                        }
                        if (!is_visible_file(conn,
-                                               smb_dname,
+                                               dir_hnd,
                                                dname,
                                                &st,
                                                false)) {
@@ -1011,7 +1011,7 @@ static NTSTATUS rmdir_internals(TALLOC_CTX *ctx, files_struct *fsp)
                                continue;
                        }
                        if (!is_visible_file(conn,
-                                               smb_dname,
+                                               dir_hnd,
                                                dname,
                                                &st,
                                                false)) {
index ecb53d7ae8ab5c8bdc8272192d6ca7723537cfd0..144f193ffbb60cc0235d7519044d95a866641462 100644 (file)
@@ -408,7 +408,7 @@ static const char *dptr_normal_ReadDirName(struct dptr_struct *dptr,
        while ((name = ReadDirName(dptr->dir_hnd, poffset, pst, &talloced))
               != NULL) {
                if (is_visible_file(dptr->conn,
-                               dptr->smb_dname,
+                               dptr->dir_hnd,
                                name,
                                pst,
                                true)) {
@@ -466,7 +466,7 @@ static char *dptr_ReadDirName(TALLOC_CTX *ctx,
 
        /* First check if it should be visible. */
        if (!is_visible_file(dptr->conn,
-                       dptr->smb_dname,
+                       dptr->dir_hnd,
                        dptr->wcard,
                        pst,
                        true)) {
@@ -1209,7 +1209,7 @@ static bool file_is_special(connection_struct *conn,
 ********************************************************************/
 
 bool is_visible_file(connection_struct *conn,
-               struct smb_filename *dir_path,
+               struct smb_Dir *dir_hnd,
                const char *name,
                SMB_STRUCT_STAT *pst,
                bool use_veto)
@@ -1219,6 +1219,7 @@ bool is_visible_file(connection_struct *conn,
        bool hide_special = lp_hide_special_files(SNUM(conn));
        int hide_new_files_timeout = lp_hide_new_files_timeout(SNUM(conn));
        char *entry = NULL;
+       struct smb_filename *dir_path = dir_hnd->fsp->fsp_name;
        struct smb_filename *smb_fname_base = NULL;
        bool ret = false;
 
@@ -1761,7 +1762,7 @@ NTSTATUS can_delete_directory_fsp(files_struct *fsp)
                }
 
                if (!is_visible_file(conn,
-                               fsp->fsp_name,
+                               dir_hnd,
                                dname,
                                &st,
                                True)) {
index e39fe4e365e16f0f10b949c27d6517c98bf0ec7b..ec4134407a6c933b43f44efe871339c1552d6235 100644 (file)
@@ -224,8 +224,9 @@ bool get_dir_entry(TALLOC_CTX *ctx,
                struct timespec *date,
                bool check_descend,
                bool ask_sharemode);
+struct smb_Dir;
 bool is_visible_file(connection_struct *conn,
-               struct smb_filename *dir_path,
+               struct smb_Dir *dir_hnd,
                const char *name,
                SMB_STRUCT_STAT *pst,
                bool use_veto);
index d87b3968d05e8db0a871485af49000205e6c2bef..6b5224b62efc8fa149f29eea1a4ac783cd224616 100644 (file)
@@ -3470,7 +3470,7 @@ NTSTATUS unlink_internals(connection_struct *conn, struct smb_request *req,
                        TALLOC_CTX *frame = talloc_stackframe();
 
                        if (!is_visible_file(conn,
-                                       smb_fname_dir,
+                                       dir_hnd,
                                        dname,
                                        &smb_fname->st,
                                        true)) {
@@ -8147,7 +8147,7 @@ NTSTATUS rename_internals(TALLOC_CTX *ctx,
                }
 
                if (!is_visible_file(conn,
-                               smb_fname_src_dir,
+                               dir_hnd,
                                dname,
                                &smb_fname_src->st,
                                false)) {
@@ -8892,7 +8892,7 @@ void reply_copy(struct smb_request *req)
                        }
 
                        if (!is_visible_file(conn,
-                                       smb_fname_src_dir,
+                                       dir_hnd,
                                        dname,
                                        &smb_fname_src->st,
                                        false)) {