From: Ralph Boehme Date: Wed, 29 Apr 2020 09:05:25 +0000 (+0200) Subject: smbd: convert inherit_from_dir arg of change_dir_owner_to_parent() to struct smb_filename X-Git-Tag: ldb-2.2.0~809 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=328716b91b1365ed0ec0a5e6f16114a453cbd88e;p=thirdparty%2Fsamba.git smbd: convert inherit_from_dir arg of change_dir_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 1aa7ca5536c..03505cab42c 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -882,26 +882,16 @@ void change_file_owner_to_parent(connection_struct *conn, } static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, - const char *inherit_from_dir, + struct smb_filename *smb_fname_parent, struct smb_filename *smb_dname, SMB_STRUCT_STAT *psbuf) { - struct smb_filename *smb_fname_parent; struct smb_filename *smb_fname_cwd = NULL; struct smb_filename *saved_dir_fname = NULL; TALLOC_CTX *ctx = talloc_tos(); NTSTATUS status = NT_STATUS_OK; int ret; - smb_fname_parent = synthetic_smb_fname(ctx, - inherit_from_dir, - NULL, - NULL, - 0); - if (smb_fname_parent == NULL) { - return NT_STATUS_NO_MEMORY; - } - ret = SMB_VFS_STAT(conn, smb_fname_parent); if (ret == -1) { status = map_nt_error_from_unix(errno); @@ -1000,7 +990,6 @@ static NTSTATUS change_dir_owner_to_parent(connection_struct *conn, vfs_ChDir(conn, saved_dir_fname); out: TALLOC_FREE(saved_dir_fname); - TALLOC_FREE(smb_fname_parent); TALLOC_FREE(smb_fname_cwd); return status; } @@ -4164,7 +4153,7 @@ static NTSTATUS mkdir_internal(connection_struct *conn, /* Change the owner if required. */ if (lp_inherit_owner(SNUM(conn)) != INHERIT_OWNER_NO) { - change_dir_owner_to_parent(conn, parent_dir, + change_dir_owner_to_parent(conn, parent_dir_fname, smb_dname, &smb_dname->st); need_re_stat = true;