From: Ralph Boehme Date: Wed, 29 Apr 2020 09:03:11 +0000 (+0200) Subject: smbd: convert inherit_from_dir arg of change_file_owner_to_parent() to struct smb_fil... X-Git-Tag: ldb-2.2.0~810 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3eb42c24ff767efd6d8335aecdd51be4549c84d3;p=thirdparty%2Fsamba.git smbd: convert inherit_from_dir arg of change_file_owner_to_parent() to struct smb_filename Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 9c7418022a0..1aa7ca5536c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -838,21 +838,11 @@ NTSTATUS fd_close(files_struct *fsp) ****************************************************************************/ void change_file_owner_to_parent(connection_struct *conn, - const char *inherit_from_dir, - files_struct *fsp) + struct smb_filename *smb_fname_parent, + files_struct *fsp) { - struct smb_filename *smb_fname_parent; int ret; - smb_fname_parent = synthetic_smb_fname(talloc_tos(), - inherit_from_dir, - NULL, - NULL, - 0); - if (smb_fname_parent == NULL) { - return; - } - ret = SMB_VFS_STAT(conn, smb_fname_parent); if (ret == -1) { DEBUG(0,("change_file_owner_to_parent: failed to stat parent " @@ -889,8 +879,6 @@ void change_file_owner_to_parent(connection_struct *conn, /* Ensure the uid entry is updated. */ fsp->fsp_name->st.st_ex_uid = smb_fname_parent->st.st_ex_uid; } - - TALLOC_FREE(smb_fname_parent); } static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, @@ -1347,7 +1335,7 @@ static NTSTATUS open_file(files_struct *fsp, /* Change the owner if required. */ if (lp_inherit_owner(SNUM(conn)) != INHERIT_OWNER_NO) { change_file_owner_to_parent(conn, - parent_dir->base_name, + parent_dir, fsp); need_re_stat = true; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index cee7f80a420..04f168dddfd 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -709,7 +709,7 @@ NTSTATUS fd_open(struct connection_struct *conn, files_struct *fsp, int flags, mode_t mode); NTSTATUS fd_close(files_struct *fsp); void change_file_owner_to_parent(connection_struct *conn, - const char *inherit_from_dir, + struct smb_filename *inherit_from_dir, files_struct *fsp); bool is_stat_open(uint32_t access_mask); NTSTATUS send_break_message(struct messaging_context *msg_ctx,