Lines Matching full:acl

51 static int	acl_special(struct archive_acl *acl,
53 static struct archive_acl_entry *acl_new_entry(struct archive_acl *acl,
55 static int archive_acl_add_entry_len_l(struct archive_acl *acl,
58 static int archive_acl_text_want_type(struct archive_acl *acl, int flags);
59 static size_t archive_acl_text_len(struct archive_acl *acl, int want_type,
130 archive_acl_clear(struct archive_acl *acl) in archive_acl_clear() argument
134 while (acl->acl_head != NULL) { in archive_acl_clear()
135 ap = acl->acl_head->next; in archive_acl_clear()
136 archive_mstring_clean(&acl->acl_head->name); in archive_acl_clear()
137 free(acl->acl_head); in archive_acl_clear()
138 acl->acl_head = ap; in archive_acl_clear()
140 free(acl->acl_text_w); in archive_acl_clear()
141 acl->acl_text_w = NULL; in archive_acl_clear()
142 free(acl->acl_text); in archive_acl_clear()
143 acl->acl_text = NULL; in archive_acl_clear()
144 acl->acl_p = NULL; in archive_acl_clear()
145 acl->acl_types = 0; in archive_acl_clear()
146 acl->acl_state = 0; /* Not counting. */ in archive_acl_clear()
168 archive_acl_add_entry(struct archive_acl *acl, in archive_acl_add_entry() argument
173 if (acl_special(acl, type, permset, tag) == 0) in archive_acl_add_entry()
175 ap = acl_new_entry(acl, type, permset, tag, id); in archive_acl_add_entry()
188 archive_acl_add_entry_w_len(struct archive_acl *acl, in archive_acl_add_entry_w_len() argument
193 if (acl_special(acl, type, permset, tag) == 0) in archive_acl_add_entry_w_len()
195 ap = acl_new_entry(acl, type, permset, tag, id); in archive_acl_add_entry_w_len()
208 archive_acl_add_entry_len_l(struct archive_acl *acl, in archive_acl_add_entry_len_l() argument
215 if (acl_special(acl, type, permset, tag) == 0) in archive_acl_add_entry_len_l()
217 ap = acl_new_entry(acl, type, permset, tag, id); in archive_acl_add_entry_len_l()
237 * If this ACL entry is part of the standard POSIX permissions set,
241 acl_special(struct archive_acl *acl, int type, int permset, int tag) in acl_special() argument
247 acl->mode &= ~0700; in acl_special()
248 acl->mode |= (permset & 7) << 6; in acl_special()
251 acl->mode &= ~0070; in acl_special()
252 acl->mode |= (permset & 7) << 3; in acl_special()
255 acl->mode &= ~0007; in acl_special()
256 acl->mode |= permset & 7; in acl_special()
264 * Allocate and populate a new ACL entry with everything but the
268 acl_new_entry(struct archive_acl *acl, in acl_new_entry() argument
277 if (acl->acl_types & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) { in acl_new_entry()
286 if (acl->acl_types & ~ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) { in acl_new_entry()
322 free(acl->acl_text_w); in acl_new_entry()
323 acl->acl_text_w = NULL; in acl_new_entry()
324 free(acl->acl_text); in acl_new_entry()
325 acl->acl_text = NULL; in acl_new_entry()
333 ap = acl->acl_head; in acl_new_entry()
353 acl->acl_head = ap; in acl_new_entry()
360 acl->acl_types |= type; in acl_new_entry()
368 archive_acl_count(struct archive_acl *acl, int want_type) in archive_acl_count() argument
374 ap = acl->acl_head; in archive_acl_count()
387 * Return a bitmask of stored ACL types in an ACL list
390 archive_acl_types(struct archive_acl *acl) in archive_acl_types() argument
392 return (acl->acl_types); in archive_acl_types()
396 * Prepare for reading entries from the ACL data. Returns a count
398 * non-extended ACL entries of that type.
401 archive_acl_reset(struct archive_acl *acl, int want_type) in archive_acl_reset() argument
405 count = archive_acl_count(acl, want_type); in archive_acl_reset()
409 * then don't return any ACL data. (In this case, in archive_acl_reset()
418 acl->acl_state = ARCHIVE_ENTRY_ACL_USER_OBJ; in archive_acl_reset()
420 acl->acl_state = 0; in archive_acl_reset()
421 acl->acl_p = acl->acl_head; in archive_acl_reset()
427 * Return the next ACL entry in the list. Fake entries for the
431 archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, in archive_acl_next() argument
442 if (acl->acl_state == 0) in archive_acl_next()
447 switch (acl->acl_state) { in archive_acl_next()
449 *permset = (acl->mode >> 6) & 7; in archive_acl_next()
452 acl->acl_state = ARCHIVE_ENTRY_ACL_GROUP_OBJ; in archive_acl_next()
455 *permset = (acl->mode >> 3) & 7; in archive_acl_next()
458 acl->acl_state = ARCHIVE_ENTRY_ACL_OTHER; in archive_acl_next()
461 *permset = acl->mode & 7; in archive_acl_next()
464 acl->acl_state = -1; in archive_acl_next()
465 acl->acl_p = acl->acl_head; in archive_acl_next()
472 while (acl->acl_p != NULL && (acl->acl_p->type & want_type) == 0) in archive_acl_next()
473 acl->acl_p = acl->acl_p->next; in archive_acl_next()
474 if (acl->acl_p == NULL) { in archive_acl_next()
475 acl->acl_state = 0; in archive_acl_next()
481 return (ARCHIVE_EOF); /* End of ACL entries. */ in archive_acl_next()
483 *type = acl->acl_p->type; in archive_acl_next()
484 *permset = acl->acl_p->permset; in archive_acl_next()
485 *tag = acl->acl_p->tag; in archive_acl_next()
486 *id = acl->acl_p->id; in archive_acl_next()
487 if (archive_mstring_get_mbs(a, &acl->acl_p->name, name) != 0) { in archive_acl_next()
492 acl->acl_p = acl->acl_p->next; in archive_acl_next()
497 * Determine what type of ACL do we want
500 archive_acl_text_want_type(struct archive_acl *acl, int flags) in archive_acl_text_want_type() argument
504 /* Check if ACL is NFSv4 */ in archive_acl_text_want_type()
505 if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) { in archive_acl_text_want_type()
507 if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) in archive_acl_text_want_type()
529 * Calculate ACL text string length
532 archive_acl_text_len(struct archive_acl *acl, int want_type, int flags, in archive_acl_text_len() argument
543 for (ap = acl->acl_head; ap != NULL; ap = ap->next) { in archive_acl_text_len()
547 * Filemode-mapping ACL entries are stored exclusively in in archive_acl_text_len()
659 * Generate a wide text version of the ACL. The flags parameter controls
660 * the type and style of the generated ACL.
663 archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, in archive_acl_to_text_w() argument
676 want_type = archive_acl_text_want_type(acl, flags); in archive_acl_to_text_w()
685 length = archive_acl_text_len(acl, want_type, flags, 1, a, NULL); in archive_acl_to_text_w()
707 acl->mode & 0700, -1); in archive_acl_to_text_w()
711 acl->mode & 0070, -1); in archive_acl_to_text_w()
715 acl->mode & 0007, -1); in archive_acl_to_text_w()
719 for (ap = acl->acl_head; ap != NULL; ap = ap->next) { in archive_acl_to_text_w()
723 * Filemode-mapping ACL entries are stored exclusively in in archive_acl_to_text_w()
847 /* POSIX.1e ACL perms */ in append_entry_w()
852 /* NFSv4 ACL perms */ in append_entry_w()
892 * Generate a text version of the ACL. The flags parameter controls
893 * the type and style of the generated ACL.
896 archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags, in archive_acl_to_text_l() argument
909 want_type = archive_acl_text_want_type(acl, flags); in archive_acl_to_text_l()
918 length = archive_acl_text_len(acl, want_type, flags, 0, NULL, sc); in archive_acl_to_text_l()
940 acl->mode & 0700, -1); in archive_acl_to_text_l()
944 acl->mode & 0070, -1); in archive_acl_to_text_l()
948 acl->mode & 0007, -1); in archive_acl_to_text_l()
952 for (ap = acl->acl_head; ap != NULL; ap = ap->next) { in archive_acl_to_text_l()
956 * Filemode-mapping ACL entries are stored exclusively in in archive_acl_to_text_l()
1082 /* POSIX.1e ACL perms */ in append_entry()
1087 /* NFSv4 ACL perms */ in append_entry()
1125 * Parse a wide ACL text string.
1128 * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS
1129 * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT
1130 * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL
1132 * POSIX.1e ACL entries prefixed with "default:" are treated as
1136 archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text, in archive_acl_from_text_w() argument
1207 * "defaultuser::rwx" is the default ACL corresponding in archive_acl_from_text_w()
1377 r = archive_acl_add_entry_w_len(acl, type, permset, in archive_acl_from_text_w()
1386 /* Reset ACL */ in archive_acl_from_text_w()
1387 archive_acl_reset(acl, types); in archive_acl_from_text_w()
1454 * Parse a string as a NFS4 ACL permission field.
1455 * Returns true if the string is non-empty and consists only of NFS4 ACL
1517 * Parse a string as a NFS4 ACL flags field.
1518 * Returns true if the string is non-empty and consists only of NFS4 ACL
1609 * Parse an ACL text string.
1612 * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS
1613 * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT
1614 * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL
1616 * POSIX.1e ACL entries prefixed with "default:" are treated as
1620 archive_acl_from_text_l(struct archive_acl *acl, const char *text, in archive_acl_from_text_l() argument
1623 return archive_acl_from_text_nl(acl, text, strlen(text), want_type, sc); in archive_acl_from_text_l()
1627 archive_acl_from_text_nl(struct archive_acl *acl, const char *text, in archive_acl_from_text_nl() argument
1697 * "defaultuser::rwx" is the default ACL corresponding in archive_acl_from_text_nl()
1874 r = archive_acl_add_entry_len_l(acl, type, permset, in archive_acl_from_text_nl()
1883 /* Reset ACL */ in archive_acl_from_text_nl()
1884 archive_acl_reset(acl, types); in archive_acl_from_text_nl()
1951 * Parse a string as a NFS4 ACL permission field.
1952 * Returns true if the string is non-empty and consists only of NFS4 ACL
2014 * Parse a string as a NFS4 ACL flags field.
2015 * Returns true if the string is non-empty and consists only of NFS4 ACL