smbd: fix check_any_access_fsp() for non-fsa fsps
authorRalph Boehme <slow@samba.org>
Thu, 21 Dec 2023 09:58:09 +0000 (10:58 +0100)
committerJule Anger <janger@samba.org>
Tue, 9 Jan 2024 12:13:13 +0000 (12:13 +0000)
commit8318428f3f8dbdbc7ff11f2755ae6b702049c72d
treee6134168a649d3d19c4485cb089f6be9eb0daea3
parent0f865a34f1a080e35ce6a4c19fec80a84c7b8dc9
smbd: fix check_any_access_fsp() for non-fsa fsps

smbd_check_access_rights_fsp() requires *all* rights in access_mask to
be granted by the underlying ACL, but the semantics of this function
is supposed to grant access if any one of the rights in
access_requested is allowed.

Fix this by looping over the requested access mask. If
smbd_check_access_rights_fsp() returns sucess, mask will be non-null
and when assigned to access_granted, the subsequent check will pass,
fail otherwise.

I'm not doing an early exit on purpose because a subsequent commit
adds additional security checks that are done in the subsequent code
path common for fsa and non-fsa fsps.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit bf497819e61131cfa6469971596af3aa9bd4bb49)
source3/smbd/proto.h
source3/smbd/smb2_trans2.c