Skip to content

Commit ad9364a

Browse files
paliSteve French
authored andcommitted
cifs: Fix getting DACL-only xattr system.cifs_acl and system.smb3_acl
Currently ->get_acl() callback always create request for OWNER, GROUP and DACL, even when only DACLs was requested by user. Change API callback to request only information for which the caller asked. Therefore when only DACLs requested, then SMB client will prepare and send DACL-only request. This change fixes retrieving of "system.cifs_acl" and "system.smb3_acl" xattrs to contain only DACL structure as documented. Note that setting/changing of "system.cifs_acl" and "system.smb3_acl" xattrs already takes only DACL structure and ignores all other fields. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 6c06be9 commit ad9364a

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

fs/smb/client/cifsacl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
15501550
int rc = 0;
15511551
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
15521552
struct smb_version_operations *ops;
1553-
const u32 info = 0;
1553+
const u32 info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO;
15541554

15551555
cifs_dbg(NOISY, "converting ACL to mode for %s\n", path);
15561556

@@ -1604,7 +1604,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16041604
struct tcon_link *tlink;
16051605
struct smb_version_operations *ops;
16061606
bool mode_from_sid, id_from_sid;
1607-
const u32 info = 0;
1607+
const u32 info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO;
16081608
bool posix;
16091609

16101610
tlink = cifs_sb_tlink(cifs_sb);

fs/smb/client/cifssmb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,8 +3403,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
34033403
/* BB TEST with big acls that might need to be e.g. larger than 16K */
34043404
pSMB->MaxSetupCount = 0;
34053405
pSMB->Fid = fid; /* file handle always le */
3406-
pSMB->AclFlags = cpu_to_le32(CIFS_ACL_OWNER | CIFS_ACL_GROUP |
3407-
CIFS_ACL_DACL | info);
3406+
pSMB->AclFlags = cpu_to_le32(info);
34083407
pSMB->ByteCount = cpu_to_le16(11); /* 3 bytes pad + 8 bytes parm */
34093408
inc_rfc1001_len(pSMB, 11);
34103409
iov[0].iov_base = (char *)pSMB;

fs/smb/client/smb2pdu.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3916,12 +3916,10 @@ SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon,
39163916
u64 persistent_fid, u64 volatile_fid,
39173917
void **data, u32 *plen, u32 extra_info)
39183918
{
3919-
__u32 additional_info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO |
3920-
extra_info;
39213919
*plen = 0;
39223920

39233921
return query_info(xid, tcon, persistent_fid, volatile_fid,
3924-
0, SMB2_O_INFO_SECURITY, additional_info,
3922+
0, SMB2_O_INFO_SECURITY, extra_info,
39253923
SMB2_MAX_BUFFER_SIZE, MIN_SEC_DESC_LEN, data, plen);
39263924
}
39273925

fs/smb/client/xattr.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,17 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
320320
if (pTcon->ses->server->ops->get_acl == NULL)
321321
goto out; /* rc already EOPNOTSUPP */
322322

323-
if (handler->flags == XATTR_CIFS_NTSD_FULL) {
324-
extra_info = SACL_SECINFO;
325-
} else {
326-
extra_info = 0;
323+
switch (handler->flags) {
324+
case XATTR_CIFS_NTSD_FULL:
325+
extra_info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO | SACL_SECINFO;
326+
break;
327+
case XATTR_CIFS_NTSD:
328+
extra_info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO;
329+
break;
330+
case XATTR_CIFS_ACL:
331+
default:
332+
extra_info = DACL_SECINFO;
333+
break;
327334
}
328335
pacl = pTcon->ses->server->ops->get_acl(cifs_sb,
329336
inode, full_path, &acllen, extra_info);

0 commit comments

Comments
 (0)