Correct the following defines to match the POSIX.1e spec:
ACL_PERM_EXEC -> ACL_EXECUTE ACL_PERM_READ -> ACL_READ ACL_PERM_WRITE -> ACL_WRITE Obtained from: TrustedBSD
This commit is contained in:
parent
5551534696
commit
fb1af1f2bf
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75404
@ -61,31 +61,31 @@ acl_from_stat(struct stat sb)
|
|||||||
acl->acl_entry[0].ae_id = sb.st_uid;
|
acl->acl_entry[0].ae_id = sb.st_uid;
|
||||||
acl->acl_entry[0].ae_perm = 0;
|
acl->acl_entry[0].ae_perm = 0;
|
||||||
if (sb.st_mode & S_IRUSR)
|
if (sb.st_mode & S_IRUSR)
|
||||||
acl->acl_entry[0].ae_perm |= ACL_PERM_READ;
|
acl->acl_entry[0].ae_perm |= ACL_READ;
|
||||||
if (sb.st_mode & S_IWUSR)
|
if (sb.st_mode & S_IWUSR)
|
||||||
acl->acl_entry[0].ae_perm |= ACL_PERM_WRITE;
|
acl->acl_entry[0].ae_perm |= ACL_WRITE;
|
||||||
if (sb.st_mode & S_IXUSR)
|
if (sb.st_mode & S_IXUSR)
|
||||||
acl->acl_entry[0].ae_perm |= ACL_PERM_EXEC;
|
acl->acl_entry[0].ae_perm |= ACL_EXECUTE;
|
||||||
|
|
||||||
acl->acl_entry[1].ae_tag = ACL_GROUP_OBJ;
|
acl->acl_entry[1].ae_tag = ACL_GROUP_OBJ;
|
||||||
acl->acl_entry[1].ae_id = sb.st_gid;
|
acl->acl_entry[1].ae_id = sb.st_gid;
|
||||||
acl->acl_entry[1].ae_perm = 0;
|
acl->acl_entry[1].ae_perm = 0;
|
||||||
if (sb.st_mode & S_IRGRP)
|
if (sb.st_mode & S_IRGRP)
|
||||||
acl->acl_entry[1].ae_perm |= ACL_PERM_READ;
|
acl->acl_entry[1].ae_perm |= ACL_READ;
|
||||||
if (sb.st_mode & S_IWGRP)
|
if (sb.st_mode & S_IWGRP)
|
||||||
acl->acl_entry[1].ae_perm |= ACL_PERM_WRITE;
|
acl->acl_entry[1].ae_perm |= ACL_WRITE;
|
||||||
if (sb.st_mode & S_IXGRP)
|
if (sb.st_mode & S_IXGRP)
|
||||||
acl->acl_entry[1].ae_perm |= ACL_PERM_EXEC;
|
acl->acl_entry[1].ae_perm |= ACL_EXECUTE;
|
||||||
|
|
||||||
acl->acl_entry[2].ae_tag = ACL_OTHER_OBJ;
|
acl->acl_entry[2].ae_tag = ACL_OTHER_OBJ;
|
||||||
acl->acl_entry[2].ae_id = 0;
|
acl->acl_entry[2].ae_id = 0;
|
||||||
acl->acl_entry[2].ae_perm = 0;
|
acl->acl_entry[2].ae_perm = 0;
|
||||||
if (sb.st_mode & S_IROTH)
|
if (sb.st_mode & S_IROTH)
|
||||||
acl->acl_entry[2].ae_perm |= ACL_PERM_READ;
|
acl->acl_entry[2].ae_perm |= ACL_READ;
|
||||||
if (sb.st_mode & S_IWOTH)
|
if (sb.st_mode & S_IWOTH)
|
||||||
acl->acl_entry[2].ae_perm |= ACL_PERM_WRITE;
|
acl->acl_entry[2].ae_perm |= ACL_WRITE;
|
||||||
if (sb.st_mode & S_IXOTH)
|
if (sb.st_mode & S_IXOTH)
|
||||||
acl->acl_entry[2].ae_perm |= ACL_PERM_EXEC;
|
acl->acl_entry[2].ae_perm |= ACL_EXECUTE;
|
||||||
|
|
||||||
acl->acl_cnt = 3;
|
acl->acl_cnt = 3;
|
||||||
|
|
||||||
|
@ -351,17 +351,17 @@ _posix1e_acl_perm_to_string(acl_perm_t perm, ssize_t buf_len, char *buf)
|
|||||||
|
|
||||||
buf[3] = 0; /* null terminate */
|
buf[3] = 0; /* null terminate */
|
||||||
|
|
||||||
if (perm & ACL_PERM_READ)
|
if (perm & ACL_READ)
|
||||||
buf[0] = ACL_STRING_PERM_READ;
|
buf[0] = ACL_STRING_PERM_READ;
|
||||||
else
|
else
|
||||||
buf[0] = ACL_STRING_PERM_NONE;
|
buf[0] = ACL_STRING_PERM_NONE;
|
||||||
|
|
||||||
if (perm & ACL_PERM_WRITE)
|
if (perm & ACL_WRITE)
|
||||||
buf[1] = ACL_STRING_PERM_WRITE;
|
buf[1] = ACL_STRING_PERM_WRITE;
|
||||||
else
|
else
|
||||||
buf[1] = ACL_STRING_PERM_NONE;
|
buf[1] = ACL_STRING_PERM_NONE;
|
||||||
|
|
||||||
if (perm & ACL_PERM_EXEC)
|
if (perm & ACL_EXECUTE)
|
||||||
buf[2] = ACL_STRING_PERM_EXEC;
|
buf[2] = ACL_STRING_PERM_EXEC;
|
||||||
else
|
else
|
||||||
buf[2] = ACL_STRING_PERM_NONE;
|
buf[2] = ACL_STRING_PERM_NONE;
|
||||||
@ -382,13 +382,13 @@ _posix1e_acl_string_to_perm(char *string, acl_perm_t *perm)
|
|||||||
while (*ch) {
|
while (*ch) {
|
||||||
switch(*ch) {
|
switch(*ch) {
|
||||||
case ACL_STRING_PERM_READ:
|
case ACL_STRING_PERM_READ:
|
||||||
myperm |= ACL_PERM_READ;
|
myperm |= ACL_READ;
|
||||||
break;
|
break;
|
||||||
case ACL_STRING_PERM_WRITE:
|
case ACL_STRING_PERM_WRITE:
|
||||||
myperm |= ACL_PERM_WRITE;
|
myperm |= ACL_WRITE;
|
||||||
break;
|
break;
|
||||||
case ACL_STRING_PERM_EXEC:
|
case ACL_STRING_PERM_EXEC:
|
||||||
myperm |= ACL_PERM_EXEC;
|
myperm |= ACL_EXECUTE;
|
||||||
break;
|
break;
|
||||||
case ACL_STRING_PERM_NONE:
|
case ACL_STRING_PERM_NONE:
|
||||||
break;
|
break;
|
||||||
|
@ -127,11 +127,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
dac_granted |= VADMIN;
|
dac_granted |= VADMIN;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
return (0);
|
return (0);
|
||||||
@ -174,11 +174,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
}
|
}
|
||||||
if (acl_mask != NULL) {
|
if (acl_mask != NULL) {
|
||||||
acl_mask_granted = 0;
|
acl_mask_granted = 0;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_EXEC)
|
if (acl_mask->ae_perm & ACL_EXECUTE)
|
||||||
acl_mask_granted |= VEXEC;
|
acl_mask_granted |= VEXEC;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_READ)
|
if (acl_mask->ae_perm & ACL_READ)
|
||||||
acl_mask_granted |= VREAD;
|
acl_mask_granted |= VREAD;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_WRITE)
|
if (acl_mask->ae_perm & ACL_WRITE)
|
||||||
acl_mask_granted |= VWRITE;
|
acl_mask_granted |= VWRITE;
|
||||||
} else
|
} else
|
||||||
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
||||||
@ -200,11 +200,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -232,11 +232,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
case ACL_GROUP:
|
case ACL_GROUP:
|
||||||
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
|
|
||||||
@ -262,13 +262,13 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
cred)) {
|
cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_EXEC)
|
ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_READ)
|
ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_WRITE)
|
ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & (dac_granted |
|
if ((acc_mode & (dac_granted |
|
||||||
@ -292,11 +292,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
||||||
*/
|
*/
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl_other->ae_perm & ACL_PERM_EXEC)
|
if (acl_other->ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl_other->ae_perm & ACL_PERM_READ)
|
if (acl_other->ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl_other->ae_perm & ACL_PERM_WRITE)
|
if (acl_other->ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
|
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -324,29 +324,29 @@ acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode)
|
|||||||
switch(tag) {
|
switch(tag) {
|
||||||
case ACL_USER_OBJ:
|
case ACL_USER_OBJ:
|
||||||
if (mode & S_IXUSR)
|
if (mode & S_IXUSR)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRUSR)
|
if (mode & S_IRUSR)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWUSR)
|
if (mode & S_IWUSR)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_GROUP_OBJ:
|
case ACL_GROUP_OBJ:
|
||||||
if (mode & S_IXGRP)
|
if (mode & S_IXGRP)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRGRP)
|
if (mode & S_IRGRP)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWGRP)
|
if (mode & S_IWGRP)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_OTHER:
|
case ACL_OTHER:
|
||||||
if (mode & S_IXOTH)
|
if (mode & S_IXOTH)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IROTH)
|
if (mode & S_IROTH)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWOTH)
|
if (mode & S_IWOTH)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -397,23 +397,23 @@ acl_posix1e_perms_to_mode(struct acl_entry *acl_user_obj_entry,
|
|||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_user_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXUSR;
|
mode |= S_IXUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_user_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRUSR;
|
mode |= S_IRUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_user_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWUSR;
|
mode |= S_IWUSR;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_group_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXGRP;
|
mode |= S_IXGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_group_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRGRP;
|
mode |= S_IRGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_group_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWGRP;
|
mode |= S_IWGRP;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_other_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXOTH;
|
mode |= S_IXOTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_READ)
|
if (acl_other_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IROTH;
|
mode |= S_IROTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_other_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWOTH;
|
mode |= S_IWOTH;
|
||||||
|
|
||||||
return (mode);
|
return (mode);
|
||||||
|
@ -127,11 +127,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
dac_granted |= VADMIN;
|
dac_granted |= VADMIN;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
return (0);
|
return (0);
|
||||||
@ -174,11 +174,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
}
|
}
|
||||||
if (acl_mask != NULL) {
|
if (acl_mask != NULL) {
|
||||||
acl_mask_granted = 0;
|
acl_mask_granted = 0;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_EXEC)
|
if (acl_mask->ae_perm & ACL_EXECUTE)
|
||||||
acl_mask_granted |= VEXEC;
|
acl_mask_granted |= VEXEC;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_READ)
|
if (acl_mask->ae_perm & ACL_READ)
|
||||||
acl_mask_granted |= VREAD;
|
acl_mask_granted |= VREAD;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_WRITE)
|
if (acl_mask->ae_perm & ACL_WRITE)
|
||||||
acl_mask_granted |= VWRITE;
|
acl_mask_granted |= VWRITE;
|
||||||
} else
|
} else
|
||||||
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
||||||
@ -200,11 +200,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -232,11 +232,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
case ACL_GROUP:
|
case ACL_GROUP:
|
||||||
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
|
|
||||||
@ -262,13 +262,13 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
cred)) {
|
cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_EXEC)
|
ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_READ)
|
ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_WRITE)
|
ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & (dac_granted |
|
if ((acc_mode & (dac_granted |
|
||||||
@ -292,11 +292,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
||||||
*/
|
*/
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl_other->ae_perm & ACL_PERM_EXEC)
|
if (acl_other->ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl_other->ae_perm & ACL_PERM_READ)
|
if (acl_other->ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl_other->ae_perm & ACL_PERM_WRITE)
|
if (acl_other->ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
|
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -324,29 +324,29 @@ acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode)
|
|||||||
switch(tag) {
|
switch(tag) {
|
||||||
case ACL_USER_OBJ:
|
case ACL_USER_OBJ:
|
||||||
if (mode & S_IXUSR)
|
if (mode & S_IXUSR)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRUSR)
|
if (mode & S_IRUSR)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWUSR)
|
if (mode & S_IWUSR)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_GROUP_OBJ:
|
case ACL_GROUP_OBJ:
|
||||||
if (mode & S_IXGRP)
|
if (mode & S_IXGRP)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRGRP)
|
if (mode & S_IRGRP)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWGRP)
|
if (mode & S_IWGRP)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_OTHER:
|
case ACL_OTHER:
|
||||||
if (mode & S_IXOTH)
|
if (mode & S_IXOTH)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IROTH)
|
if (mode & S_IROTH)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWOTH)
|
if (mode & S_IWOTH)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -397,23 +397,23 @@ acl_posix1e_perms_to_mode(struct acl_entry *acl_user_obj_entry,
|
|||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_user_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXUSR;
|
mode |= S_IXUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_user_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRUSR;
|
mode |= S_IRUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_user_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWUSR;
|
mode |= S_IWUSR;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_group_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXGRP;
|
mode |= S_IXGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_group_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRGRP;
|
mode |= S_IRGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_group_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWGRP;
|
mode |= S_IWGRP;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_other_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXOTH;
|
mode |= S_IXOTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_READ)
|
if (acl_other_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IROTH;
|
mode |= S_IROTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_other_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWOTH;
|
mode |= S_IWOTH;
|
||||||
|
|
||||||
return (mode);
|
return (mode);
|
||||||
|
@ -127,11 +127,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
dac_granted |= VADMIN;
|
dac_granted |= VADMIN;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
return (0);
|
return (0);
|
||||||
@ -174,11 +174,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
}
|
}
|
||||||
if (acl_mask != NULL) {
|
if (acl_mask != NULL) {
|
||||||
acl_mask_granted = 0;
|
acl_mask_granted = 0;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_EXEC)
|
if (acl_mask->ae_perm & ACL_EXECUTE)
|
||||||
acl_mask_granted |= VEXEC;
|
acl_mask_granted |= VEXEC;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_READ)
|
if (acl_mask->ae_perm & ACL_READ)
|
||||||
acl_mask_granted |= VREAD;
|
acl_mask_granted |= VREAD;
|
||||||
if (acl_mask->ae_perm & ACL_PERM_WRITE)
|
if (acl_mask->ae_perm & ACL_WRITE)
|
||||||
acl_mask_granted |= VWRITE;
|
acl_mask_granted |= VWRITE;
|
||||||
} else
|
} else
|
||||||
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
acl_mask_granted = VEXEC | VREAD | VWRITE;
|
||||||
@ -200,11 +200,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
if (acl->acl_entry[i].ae_id != cred->cr_uid)
|
||||||
break;
|
break;
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -232,11 +232,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
case ACL_GROUP:
|
case ACL_GROUP:
|
||||||
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
if (groupmember(acl->acl_entry[i].ae_id, cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_EXEC)
|
if (acl->acl_entry[i].ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_READ)
|
if (acl->acl_entry[i].ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm & ACL_PERM_WRITE)
|
if (acl->acl_entry[i].ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
|
|
||||||
@ -262,13 +262,13 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
cred)) {
|
cred)) {
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_EXEC)
|
ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_READ)
|
ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl->acl_entry[i].ae_perm &
|
if (acl->acl_entry[i].ae_perm &
|
||||||
ACL_PERM_WRITE)
|
ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
dac_granted &= acl_mask_granted;
|
dac_granted &= acl_mask_granted;
|
||||||
if ((acc_mode & (dac_granted |
|
if ((acc_mode & (dac_granted |
|
||||||
@ -292,11 +292,11 @@ vaccess_acl_posix1e(enum vtype type, struct acl *acl, mode_t acc_mode,
|
|||||||
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
* Fall back on ACL_OTHER. ACL_MASK is not applied to ACL_OTHER.
|
||||||
*/
|
*/
|
||||||
dac_granted = 0;
|
dac_granted = 0;
|
||||||
if (acl_other->ae_perm & ACL_PERM_EXEC)
|
if (acl_other->ae_perm & ACL_EXECUTE)
|
||||||
dac_granted |= VEXEC;
|
dac_granted |= VEXEC;
|
||||||
if (acl_other->ae_perm & ACL_PERM_READ)
|
if (acl_other->ae_perm & ACL_READ)
|
||||||
dac_granted |= VREAD;
|
dac_granted |= VREAD;
|
||||||
if (acl_other->ae_perm & ACL_PERM_WRITE)
|
if (acl_other->ae_perm & ACL_WRITE)
|
||||||
dac_granted |= VWRITE;
|
dac_granted |= VWRITE;
|
||||||
|
|
||||||
if ((acc_mode & dac_granted) == acc_mode)
|
if ((acc_mode & dac_granted) == acc_mode)
|
||||||
@ -324,29 +324,29 @@ acl_posix1e_mode_to_perm(acl_tag_t tag, mode_t mode)
|
|||||||
switch(tag) {
|
switch(tag) {
|
||||||
case ACL_USER_OBJ:
|
case ACL_USER_OBJ:
|
||||||
if (mode & S_IXUSR)
|
if (mode & S_IXUSR)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRUSR)
|
if (mode & S_IRUSR)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWUSR)
|
if (mode & S_IWUSR)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_GROUP_OBJ:
|
case ACL_GROUP_OBJ:
|
||||||
if (mode & S_IXGRP)
|
if (mode & S_IXGRP)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IRGRP)
|
if (mode & S_IRGRP)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWGRP)
|
if (mode & S_IWGRP)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
case ACL_OTHER:
|
case ACL_OTHER:
|
||||||
if (mode & S_IXOTH)
|
if (mode & S_IXOTH)
|
||||||
perm |= ACL_PERM_EXEC;
|
perm |= ACL_EXECUTE;
|
||||||
if (mode & S_IROTH)
|
if (mode & S_IROTH)
|
||||||
perm |= ACL_PERM_READ;
|
perm |= ACL_READ;
|
||||||
if (mode & S_IWOTH)
|
if (mode & S_IWOTH)
|
||||||
perm |= ACL_PERM_WRITE;
|
perm |= ACL_WRITE;
|
||||||
return (perm);
|
return (perm);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -397,23 +397,23 @@ acl_posix1e_perms_to_mode(struct acl_entry *acl_user_obj_entry,
|
|||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
mode = 0;
|
mode = 0;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_user_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXUSR;
|
mode |= S_IXUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_user_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRUSR;
|
mode |= S_IRUSR;
|
||||||
if (acl_user_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_user_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWUSR;
|
mode |= S_IWUSR;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_group_obj_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXGRP;
|
mode |= S_IXGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_READ)
|
if (acl_group_obj_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IRGRP;
|
mode |= S_IRGRP;
|
||||||
if (acl_group_obj_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_group_obj_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWGRP;
|
mode |= S_IWGRP;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_EXEC)
|
if (acl_other_entry->ae_perm & ACL_EXECUTE)
|
||||||
mode |= S_IXOTH;
|
mode |= S_IXOTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_READ)
|
if (acl_other_entry->ae_perm & ACL_READ)
|
||||||
mode |= S_IROTH;
|
mode |= S_IROTH;
|
||||||
if (acl_other_entry->ae_perm & ACL_PERM_WRITE)
|
if (acl_other_entry->ae_perm & ACL_WRITE)
|
||||||
mode |= S_IWOTH;
|
mode |= S_IWOTH;
|
||||||
|
|
||||||
return (mode);
|
return (mode);
|
||||||
|
@ -86,12 +86,12 @@ typedef struct acl *acl_t;
|
|||||||
/*
|
/*
|
||||||
* Possible flags in ae_perm field.
|
* Possible flags in ae_perm field.
|
||||||
*/
|
*/
|
||||||
#define ACL_PERM_EXEC 0x0001
|
#define ACL_EXECUTE 0x0001
|
||||||
#define ACL_PERM_WRITE 0x0002
|
#define ACL_WRITE 0x0002
|
||||||
#define ACL_PERM_READ 0x0004
|
#define ACL_READ 0x0004
|
||||||
#define ACL_PERM_NONE 0x0000
|
#define ACL_PERM_NONE 0x0000
|
||||||
#define ACL_PERM_BITS (ACL_PERM_EXEC | ACL_PERM_WRITE | ACL_PERM_READ)
|
#define ACL_PERM_BITS (ACL_EXECUTE | ACL_WRITE | ACL_READ)
|
||||||
#define ACL_POSIX1E_BITS (ACL_PERM_EXEC | ACL_PERM_WRITE | ACL_PERM_READ)
|
#define ACL_POSIX1E_BITS (ACL_EXECUTE | ACL_WRITE | ACL_READ)
|
||||||
|
|
||||||
#ifdef _KERNEL
|
#ifdef _KERNEL
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user