Changeset View
Changeset View
Standalone View
Standalone View
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
Show First 20 Lines • Show All 886 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
uint64_t | uint64_t | ||||
zfs_mode_compute(uint64_t fmode, zfs_acl_t *aclp, | zfs_mode_compute(uint64_t fmode, zfs_acl_t *aclp, | ||||
uint64_t *pflags, uint64_t fuid, uint64_t fgid) | uint64_t *pflags, uint64_t fuid, uint64_t fgid) | ||||
{ | { | ||||
int entry_type; | int entry_type; | ||||
mode_t mode; | mode_t mode; | ||||
mode_t seen = 0; | mode_t seen = 0; | ||||
zfs_ace_hdr_t *acep = NULL; | zfs_ace_hdr_t *acep = NULL; | ||||
uint64_t who; | uint64_t who; | ||||
uint16_t iflags, type; | uint16_t iflags, type; | ||||
uint32_t access_mask; | uint32_t access_mask; | ||||
boolean_t an_exec_denied = B_FALSE; | boolean_t an_exec_denied = B_FALSE; | ||||
mode = (fmode & (S_IFMT | S_ISUID | S_ISGID | S_ISVTX)); | mode = (fmode & (S_IFMT | S_ISUID | S_ISGID | S_ISVTX)); | ||||
while (acep = zfs_acl_next_ace(aclp, acep, &who, | while (acep = zfs_acl_next_ace(aclp, acep, &who, | ||||
▲ Show 20 Lines • Show All 411 Lines • ▼ Show 20 Lines | |||||
static void | static void | ||||
zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t split, boolean_t trim, | zfs_acl_chmod(vtype_t vtype, uint64_t mode, boolean_t split, boolean_t trim, | ||||
zfs_acl_t *aclp) | zfs_acl_t *aclp) | ||||
{ | { | ||||
void *acep = NULL; | void *acep = NULL; | ||||
uint64_t who; | uint64_t who; | ||||
int new_count, new_bytes; | int new_count, new_bytes; | ||||
int ace_size; | int ace_size; | ||||
int entry_type; | int entry_type; | ||||
uint16_t iflags, type; | uint16_t iflags, type; | ||||
uint32_t access_mask; | uint32_t access_mask; | ||||
zfs_acl_node_t *newnode; | zfs_acl_node_t *newnode; | ||||
size_t abstract_size = aclp->z_ops.ace_abstract_size(); | size_t abstract_size = aclp->z_ops.ace_abstract_size(); | ||||
void *zacep; | void *zacep; | ||||
boolean_t isdir; | boolean_t isdir; | ||||
trivial_acl_t masks; | trivial_acl_t masks; | ||||
new_count = new_bytes = 0; | new_count = new_bytes = 0; | ||||
isdir = (vtype == VDIR); | isdir = (vtype == VDIR); | ||||
acl_trivial_access_masks((mode_t)mode, isdir, &masks); | acl_trivial_access_masks((mode_t)mode, isdir, &masks); | ||||
▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | |||||
* Retrieve a file's ACL | * Retrieve a file's ACL | ||||
*/ | */ | ||||
int | int | ||||
zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) | zfs_getacl(znode_t *zp, vsecattr_t *vsecp, boolean_t skipaclchk, cred_t *cr) | ||||
{ | { | ||||
zfs_acl_t *aclp; | zfs_acl_t *aclp; | ||||
ulong_t mask; | ulong_t mask; | ||||
int error; | int error; | ||||
int count = 0; | int count = 0; | ||||
int largeace = 0; | int largeace = 0; | ||||
mask = vsecp->vsa_mask & (VSA_ACE | VSA_ACECNT | | mask = vsecp->vsa_mask & (VSA_ACE | VSA_ACECNT | | ||||
VSA_ACE_ACLFLAGS | VSA_ACE_ALLTYPES); | VSA_ACE_ACLFLAGS | VSA_ACE_ALLTYPES); | ||||
if (mask == 0) | if (mask == 0) | ||||
return (SET_ERROR(ENOSYS)); | return (SET_ERROR(ENOSYS)); | ||||
▲ Show 20 Lines • Show All 314 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode, | zfs_zaccess_aces_check(znode_t *zp, uint32_t *working_mode, | ||||
boolean_t anyaccess, cred_t *cr) | boolean_t anyaccess, cred_t *cr) | ||||
{ | { | ||||
zfsvfs_t *zfsvfs = zp->z_zfsvfs; | zfsvfs_t *zfsvfs = zp->z_zfsvfs; | ||||
zfs_acl_t *aclp; | zfs_acl_t *aclp; | ||||
int error; | int error; | ||||
uid_t uid = crgetuid(cr); | uid_t uid = crgetuid(cr); | ||||
uint64_t who; | uint64_t who; | ||||
uint16_t type, iflags; | uint16_t type, iflags; | ||||
uint16_t entry_type; | uint16_t entry_type; | ||||
uint32_t access_mask; | uint32_t access_mask; | ||||
uint32_t deny_mask = 0; | uint32_t deny_mask = 0; | ||||
zfs_ace_hdr_t *acep = NULL; | zfs_ace_hdr_t *acep = NULL; | ||||
boolean_t checkit; | boolean_t checkit; | ||||
uid_t gowner; | uid_t gowner; | ||||
uid_t fowner; | uid_t fowner; | ||||
▲ Show 20 Lines • Show All 257 Lines • ▼ Show 20 Lines | |||||
* can define any form of access. | * can define any form of access. | ||||
*/ | */ | ||||
int | int | ||||
zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) | zfs_zaccess(znode_t *zp, int mode, int flags, boolean_t skipaclchk, cred_t *cr) | ||||
{ | { | ||||
uint32_t working_mode; | uint32_t working_mode; | ||||
int error; | int error; | ||||
int is_attr; | int is_attr; | ||||
boolean_t check_privs; | boolean_t check_privs; | ||||
znode_t *xzp; | znode_t *xzp; | ||||
znode_t *check_zp = zp; | znode_t *check_zp = zp; | ||||
mode_t needed_bits; | mode_t needed_bits; | ||||
uid_t owner; | uid_t owner; | ||||
is_attr = ((zp->z_pflags & ZFS_XATTR) && (ZTOV(zp)->v_type == VDIR)); | is_attr = ((zp->z_pflags & ZFS_XATTR) && (ZTOV(zp)->v_type == VDIR)); | ||||
#ifdef __FreeBSD_kernel__ | #ifdef __FreeBSD_kernel__ | ||||
/* | /* | ||||
* In FreeBSD, we don't care about permissions of individual ADS. | * In FreeBSD, we don't care about permissions of individual ADS. | ||||
▲ Show 20 Lines • Show All 349 Lines • Show Last 20 Lines |