1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

smbd: fix opening a READ-ONLY file with SEC_FLAG_MAXIMUM_ALLOWED

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14215

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Aug 29 18:20:20 UTC 2022 on sn-devel-184
This commit is contained in:
Ralph Boehme 2022-08-19 12:02:43 +02:00 committed by Jeremy Allison
parent 169d8fe4a9
commit 772319412d
2 changed files with 6 additions and 1 deletions

View File

@ -1 +0,0 @@
^samba3.smb2.maximum_allowed.read_only

View File

@ -3269,6 +3269,7 @@ static NTSTATUS smbd_calculate_maximum_allowed_access_fsp(
{
struct security_descriptor *sd = NULL;
uint32_t access_granted = 0;
uint32_t dosattrs;
NTSTATUS status;
/* Cope with symlinks */
@ -3345,6 +3346,11 @@ static NTSTATUS smbd_calculate_maximum_allowed_access_fsp(
}
}
dosattrs = fdos_mode(fsp);
if (IS_DOS_READONLY(dosattrs) || !CAN_WRITE(fsp->conn)) {
*p_access_mask &= ~(FILE_GENERIC_WRITE | DELETE_ACCESS);
}
return NT_STATUS_OK;
}