From 2243ba78d9dc4c3515217001f907be5ed0c1fea3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 29 Apr 2020 14:43:50 -0700 Subject: [PATCH] s3: smbd: Change is_visible_file() to take a directory handle not a name. 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 Reviewed-by: Ralph Boehme --- source3/smbd/close.c | 6 +++--- source3/smbd/dir.c | 9 +++++---- source3/smbd/proto.h | 3 ++- source3/smbd/reply.c | 6 +++--- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 42aedff6a78..d0988afcec0 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -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)) { diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index ecb53d7ae8a..144f193ffbb 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -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)) { diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index e39fe4e365e..ec4134407a6 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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); diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index d87b3968d05..6b5224b62ef 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -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)) { -- 2.47.3