From: Jeremy Allison Date: Thu, 30 Apr 2020 22:28:32 +0000 (-0700) Subject: s3: smbd: Add dirfsp parameter to can_delete_file_in_directory(). X-Git-Tag: ldb-2.2.0~774 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=839a2fb7a5e7d47ffe1d472e769c30df90c2a7e1;p=thirdparty%2Fsamba.git s3: smbd: Add dirfsp parameter to can_delete_file_in_directory(). Not yet used. Currently always conn->cwd_fsp. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/file_access.c b/source3/smbd/file_access.c index 6c4f38b6a9c..a05b031c62d 100644 --- a/source3/smbd/file_access.c +++ b/source3/smbd/file_access.c @@ -33,12 +33,15 @@ ****************************************************************************/ bool can_delete_file_in_directory(connection_struct *conn, + struct files_struct *dirfsp, const struct smb_filename *smb_fname) { TALLOC_CTX *ctx = talloc_tos(); struct smb_filename *smb_fname_parent = NULL; bool ret; + SMB_ASSERT(dirfsp == conn->cwd_fsp); + if (!CAN_WRITE(conn)) { return False; } diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 039e9f4786b..1736ecf990f 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -82,6 +82,7 @@ static bool parent_override_delete(connection_struct *conn, if ((access_mask & DELETE_ACCESS) && (rejected_mask & DELETE_ACCESS) && can_delete_file_in_directory(conn, + conn->cwd_fsp, smb_fname)) { return true; @@ -3074,6 +3075,7 @@ static NTSTATUS smbd_calculate_maximum_allowed_access( if (!(access_granted & DELETE_ACCESS)) { if (can_delete_file_in_directory(conn, + conn->cwd_fsp, smb_fname)) { *p_access_mask |= DELETE_ACCESS; diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 5e81670b5fa..cdb7dcce41c 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -331,6 +331,7 @@ void reply_openerror(struct smb_request *req, NTSTATUS status); /* The following definitions come from smbd/file_access.c */ bool can_delete_file_in_directory(connection_struct *conn, + struct files_struct *dirfsp, const struct smb_filename *smb_fname); bool can_write_to_file(connection_struct *conn, const struct smb_filename *smb_fname);