From: Ralph Boehme Date: Tue, 28 Apr 2020 13:21:37 +0000 (+0200) Subject: smbd: use parent_smb_fname() in can_delete_file_in_directory() X-Git-Tag: ldb-2.2.0~833 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1ba69abad08262c71461a6b660c7589d40d596;p=thirdparty%2Fsamba.git smbd: use parent_smb_fname() in can_delete_file_in_directory() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index cc939325e62..39a8f195040 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -36,8 +36,7 @@ bool can_delete_file_in_directory(connection_struct *conn, const struct smb_filename *smb_fname) { TALLOC_CTX *ctx = talloc_tos(); - char *dname = NULL; - struct smb_filename *smb_fname_parent; + struct smb_filename *smb_fname_parent = NULL; bool ret; if (!CAN_WRITE(conn)) { @@ -50,18 +49,9 @@ bool can_delete_file_in_directory(connection_struct *conn, } /* Get the parent directory permission mask and owners. */ - if (!parent_dirname(ctx, smb_fname->base_name, &dname, NULL)) { - return False; - } - - smb_fname_parent = synthetic_smb_fname(ctx, - dname, - NULL, - NULL, - smb_fname->flags); - if (smb_fname_parent == NULL) { - ret = false; - goto out; + ret = parent_smb_fname(ctx, smb_fname, &smb_fname_parent, NULL); + if (ret != true) { + return false; } if(SMB_VFS_STAT(conn, smb_fname_parent) != 0) { @@ -129,7 +119,6 @@ bool can_delete_file_in_directory(connection_struct *conn, false, FILE_DELETE_CHILD)); out: - TALLOC_FREE(dname); TALLOC_FREE(smb_fname_parent); return ret; }