]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: split read-only checks in smbd_calculate_maximum_allowed_access_fsp()
authorRalph Boehme <slow@samba.org>
Thu, 9 Apr 2026 08:13:49 +0000 (10:13 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Apr 2026 10:56:35 +0000 (10:56 +0000)
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 <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/open.c

index c8c2a520aa4f59f07cc59543a4aae7de9da62d22..594ffadfeb8f94db7eedfa1231f40243bec48f7f 100644 (file)
@@ -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);
        }