From: Ralph Boehme Date: Thu, 9 Apr 2026 08:13:49 +0000 (+0200) Subject: smbd: split read-only checks in smbd_calculate_maximum_allowed_access_fsp() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=671c7bb4dc9c7142b7eeaa673b6cc692b5b67425;p=thirdparty%2Fsamba.git smbd: split read-only checks in smbd_calculate_maximum_allowed_access_fsp() Prepares for adjusting the permission when the FILE_ATTRIBUTE_READONLY is set in the next commmit. No change in behaviour. BUG: https://bugzilla.samba.org/show_bug.cgi?id=16030 Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index c8c2a520aa4..594ffadfeb8 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3385,8 +3385,12 @@ static NTSTATUS smbd_calculate_maximum_allowed_access_fsp( } } + if (!CAN_WRITE(fsp->conn)) { + *p_access_mask &= ~(FILE_GENERIC_WRITE | DELETE_ACCESS); + } + dosattrs = fdos_mode(fsp); - if ((dosattrs & FILE_ATTRIBUTE_READONLY) || !CAN_WRITE(fsp->conn)) { + if (dosattrs & FILE_ATTRIBUTE_READONLY) { *p_access_mask &= ~(FILE_GENERIC_WRITE | DELETE_ACCESS); }