fs/smb/client/cifsacl.c
Source file repositories/reference/linux-study-clean/fs/smb/client/cifsacl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/smb/client/cifsacl.c- Extension
.c- Size
- 53535 bytes
- Lines
- 1986
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/fs.hlinux/slab.hlinux/string.hlinux/keyctl.hlinux/key-type.huapi/linux/posix_acl.hlinux/posix_acl.hlinux/posix_acl_xattr.hkeys/user-type.hcifsglob.hcifsacl.hcifsproto.hcifs_debug.hfs_context.hcifs_fs_sb.hcifs_unicode.h
Detected Declarations
function cifs_idmap_key_instantiatefunction cifs_idmap_key_destroyfunction sid_to_key_strfunction SIDsfunction is_well_known_sidfunction cifs_copy_sidfunction parse_sidfunction sid_from_sdfunction id_to_sidfunction sid_to_idfunction init_cifs_idmapfunction exit_cifs_idmapfunction copy_sec_descfunction modefunction mode_to_access_flagsfunction cifs_copy_acefunction fill_ace_for_sidfunction dump_acefunction validate_daclfunction parse_daclfunction setup_authusers_ACEfunction setup_special_mode_ACEfunction setup_special_user_owner_ACEfunction populate_new_acesfunction replace_sids_and_copy_acesfunction set_chmod_daclfunction dacl_offset_validfunction parse_sec_descfunction build_sec_descfunction set_cifs_aclfunction cifs_acl_to_fattrfunction id_mode_to_cifs_aclfunction cifs_set_acl
Annotated Snippet
if (ctsid->authority[i] != cwsid->authority[i]) {
if (ctsid->authority[i] > cwsid->authority[i])
return 1;
else
return -1;
}
}
/* compare all of the subauth values if any */
num_sat = ctsid->num_subauth;
num_saw = cwsid->num_subauth;
num_subauth = min(num_sat, num_saw);
if (num_subauth) {
for (i = 0; i < num_subauth; ++i) {
if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) {
if (le32_to_cpu(ctsid->sub_auth[i]) >
le32_to_cpu(cwsid->sub_auth[i]))
return 1;
else
return -1;
}
}
}
return 0; /* sids compare/match */
}
static bool
is_well_known_sid(const struct smb_sid *psid, uint32_t *puid, bool is_group)
{
int i;
int num_subauth;
const struct smb_sid *pwell_known_sid;
if (!psid || (puid == NULL))
return false;
num_subauth = psid->num_subauth;
/* check if Mac (or Windows NFS) vs. Samba format for Unix owner SID */
if (num_subauth == 2) {
if (is_group)
pwell_known_sid = &sid_unix_groups;
else
pwell_known_sid = &sid_unix_users;
} else if (num_subauth == 3) {
if (is_group)
pwell_known_sid = &sid_unix_NFS_groups;
else
pwell_known_sid = &sid_unix_NFS_users;
} else
return false;
/* compare the revision */
if (psid->revision != pwell_known_sid->revision)
return false;
/* compare all of the six auth values */
for (i = 0; i < NUM_AUTHS; ++i) {
if (psid->authority[i] != pwell_known_sid->authority[i]) {
cifs_dbg(FYI, "auth %d did not match\n", i);
return false;
}
}
if (num_subauth == 2) {
if (psid->sub_auth[0] != pwell_known_sid->sub_auth[0])
return false;
*puid = le32_to_cpu(psid->sub_auth[1]);
} else /* 3 subauths, ie Windows/Mac style */ {
*puid = le32_to_cpu(psid->sub_auth[0]);
if ((psid->sub_auth[0] != pwell_known_sid->sub_auth[0]) ||
(psid->sub_auth[1] != pwell_known_sid->sub_auth[1]))
return false;
*puid = le32_to_cpu(psid->sub_auth[2]);
}
cifs_dbg(FYI, "Unix UID %d returned from SID\n", *puid);
return true; /* well known sid found, uid returned */
}
static __u16
cifs_copy_sid(struct smb_sid *dst, const struct smb_sid *src)
{
int i;
__u16 size = 1 + 1 + 6;
dst->revision = src->revision;
Annotation
- Immediate include surface: `linux/fs.h`, `linux/slab.h`, `linux/string.h`, `linux/keyctl.h`, `linux/key-type.h`, `uapi/linux/posix_acl.h`, `linux/posix_acl.h`, `linux/posix_acl_xattr.h`.
- Detected declarations: `function cifs_idmap_key_instantiate`, `function cifs_idmap_key_destroy`, `function sid_to_key_str`, `function SIDs`, `function is_well_known_sid`, `function cifs_copy_sid`, `function parse_sid`, `function sid_from_sd`, `function id_to_sid`, `function sid_to_id`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.