diff options
| author | Gleb Popov <arrowd@FreeBSD.org> | 2021-01-20 09:47:44 +0000 |
|---|---|---|
| committer | Gleb Popov <arrowd@FreeBSD.org> | 2021-08-27 08:52:18 +0000 |
| commit | fcef0684f1084aeacae556adc5d4d5853b7e748e (patch) | |
| tree | 5c78afbd447877199a5ea3cc8a26c9565845c878 /bin/getfacl | |
| parent | d81d5b2f2c9cda96ad960aac3313b89b2769323e (diff) | |
Diffstat (limited to 'bin/getfacl')
| -rw-r--r-- | bin/getfacl/getfacl.c | 93 |
1 files changed, 1 insertions, 92 deletions
diff --git a/bin/getfacl/getfacl.c b/bin/getfacl/getfacl.c index d59ddbcfc871..ecdc73f74fbc 100644 --- a/bin/getfacl/getfacl.c +++ b/bin/getfacl/getfacl.c @@ -83,97 +83,6 @@ getgname(gid_t gid) return (gr->gr_name); } -/* - * return an ACL corresponding to the permissions - * contained in mode_t - */ -static acl_t -acl_from_mode(const mode_t mode) -{ - acl_t acl; - acl_entry_t entry; - acl_permset_t perms; - - /* create the ACL */ - acl = acl_init(3); - if (!acl) - return NULL; - - /* First entry: ACL_USER_OBJ */ - if (acl_create_entry(&acl, &entry) == -1) - return NULL; - if (acl_set_tag_type(entry, ACL_USER_OBJ) == -1) - return NULL; - - if (acl_get_permset(entry, &perms) == -1) - return NULL; - if (acl_clear_perms(perms) == -1) - return NULL; - - /* calculate user mode */ - if (mode & S_IRUSR) - if (acl_add_perm(perms, ACL_READ) == -1) - return NULL; - if (mode & S_IWUSR) - if (acl_add_perm(perms, ACL_WRITE) == -1) - return NULL; - if (mode & S_IXUSR) - if (acl_add_perm(perms, ACL_EXECUTE) == -1) - return NULL; - if (acl_set_permset(entry, perms) == -1) - return NULL; - - /* Second entry: ACL_GROUP_OBJ */ - if (acl_create_entry(&acl, &entry) == -1) - return NULL; - if (acl_set_tag_type(entry, ACL_GROUP_OBJ) == -1) - return NULL; - - if (acl_get_permset(entry, &perms) == -1) - return NULL; - if (acl_clear_perms(perms) == -1) - return NULL; - - /* calculate group mode */ - if (mode & S_IRGRP) - if (acl_add_perm(perms, ACL_READ) == -1) - return NULL; - if (mode & S_IWGRP) - if (acl_add_perm(perms, ACL_WRITE) == -1) - return NULL; - if (mode & S_IXGRP) - if (acl_add_perm(perms, ACL_EXECUTE) == -1) - return NULL; - if (acl_set_permset(entry, perms) == -1) - return NULL; - - /* Third entry: ACL_OTHER */ - if (acl_create_entry(&acl, &entry) == -1) - return NULL; - if (acl_set_tag_type(entry, ACL_OTHER) == -1) - return NULL; - - if (acl_get_permset(entry, &perms) == -1) - return NULL; - if (acl_clear_perms(perms) == -1) - return NULL; - - /* calculate other mode */ - if (mode & S_IROTH) - if (acl_add_perm(perms, ACL_READ) == -1) - return NULL; - if (mode & S_IWOTH) - if (acl_add_perm(perms, ACL_WRITE) == -1) - return NULL; - if (mode & S_IXOTH) - if (acl_add_perm(perms, ACL_EXECUTE) == -1) - return NULL; - if (acl_set_permset(entry, perms) == -1) - return NULL; - - return(acl); -} - static int print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag, int qflag, int vflag) @@ -229,7 +138,7 @@ print_acl(char *path, acl_type_t type, int hflag, int iflag, int nflag, errno = 0; if (type == ACL_TYPE_DEFAULT) return(0); - acl = acl_from_mode(sb.st_mode); + acl = acl_from_mode_np(sb.st_mode); if (!acl) { warn("%s: acl_from_mode() failed", path); return(-1); |
