]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
smb/client: fix security flag calculation when setting security descriptors
authorRalph Boehme <slow@samba.org>
Sat, 20 Jun 2026 07:12:42 +0000 (09:12 +0200)
committerSteve French <stfrench@microsoft.com>
Wed, 24 Jun 2026 15:33:41 +0000 (10:33 -0500)
commit4939889c985da68936090cc013e58c28b7bff34f
treeb9393d980c6493e9085720111c21a6b7b47810fc
parenta540a64c4801fe02e452ee37e961018106418260
smb/client: fix security flag calculation when setting security descriptors

In id_mode_to_cifs_acl(), aclflag was initialized to CIFS_ACL_DACL by default.
This forced the client to request setting the DACL even when only an ownership
(chown) or group (chgrp) change was being performed.

Let build_sec_desc() do the proper flag calculation by initializing aclflag
to 0. build_sec_desc() sets the appropriate bits (CIFS_ACL_OWNER, CIFS_ACL_GROUP,
or CIFS_ACL_DACL) depending on what actually changed. During ownership transfer,
CIFS_ACL_DACL is only set if replace_sids_and_copy_aces() actually replaces the
SIDs inside any of the DACL's ACEs.

If build_sec_desc() results in aclflag being 0 (meaning no changes were mapped),
exit early to avoid sending an empty security descriptor update to the server.

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifsacl.c