1ARCHIVE_ENTRY_ACL(3) BSD Library Functions Manual ARCHIVE_ENTRY_ACL(3)
2
4 archive_entry_acl_add_entry, archive_entry_acl_add_entry_w,
5 archive_entry_acl_clear, archive_entry_acl_count, archive_entry_acl_next,
6 archive_entry_acl_next_w, archive_entry_acl_reset,
7 archive_entry_acl_text_w — functions for manipulating Access Control
8 Lists in archive entry descriptions
9
11 Streaming Archive Library (libarchive, -larchive)
12
14 #include <archive_entry.h>
15
16 void
17 archive_entry_acl_add_entry(struct archive_entry *a, int type,
18 int permset, int tag, int qualifier, const char *name);
19
20 void
21 archive_entry_acl_add_entry_w(struct archive_entry *a, int type,
22 int permset, int tag, int qualifier, const wchar_t *name);
23
24 void
25 archive_entry_acl_clear(struct archive_entry *a);
26
27 int
28 archive_entry_acl_count(struct archive_entry *a, int type);
29
30 int
31 archive_entry_acl_next(struct archive_entry *a, int type, int *ret_type,
32 int *ret_permset, int *ret_tag, int *ret_qual,
33 const char **ret_name);
34
35 int
36 archive_entry_acl_next_w(struct archive_entry *a, int type,
37 int *ret_type, int *ret_permset, int *ret_tag, int *ret_qual,
38 const wchar_t **ret_name);
39
40 int
41 archive_entry_acl_reset(struct archive_entry *a, int type);
42
43 const wchar_t *
44 archive_entry_acl_text_w(struct archive_entry *a, int flags);
45
47 An “Access Control List” is a generalisation of the classic Unix permis‐
48 sion system. The ACL interface of libarchive is derived from the
49 POSIX.1e draft, but restricted to simplify dealing with practical imple‐
50 mentations in various Operating Systems and archive formats.
51
52 An ACL consists of a number of independent entries. Each entry specifies
53 the permission set as bitmask of basic permissions. Valid permissions
54 are:
55 ARCHIVE_ENTRY_ACL_EXECUTE
56 ARCHIVE_ENTRY_ACL_WRITE
57 ARCHIVE_ENTRY_ACL_READ
58 The permissions correspond to the normal Unix permissions.
59
60 The tag specifies the principal to which the permission applies. Valid
61 values are:
62 ARCHIVE_ENTRY_ACL_USER The user specified by the name field.
63 ARCHIVE_ENTRY_ACL_USER_OBJ The owner of the file.
64 ARCHIVE_ENTRY_ACL_GROUP The group specied by the name field.
65 ARCHIVE_ENTRY_ACL_GROUP_OBJ The group who owns the file.
66 ARCHIVE_ENTRY_ACL_MASK The maximum permissions to be obtained
67 via group permissions.
68 ARCHIVE_ENTRY_ACL_OTHER Any principal who doesn't have a user
69 or group entry.
70 The principals ARCHIVE_ENTRY_ACL_USER_OBJ, ARCHIVE_ENTRY_ACL_GROUP_OBJ
71 and ARCHIVE_ENTRY_ACL_OTHER are equivalent to user, group and other in
72 the classic Unix permission model and specify non-extended ACL entries.
73
74 All files have an access ACL (ARCHIVE_ENTRY_ACL_TYPE_ACCESS). This spec‐
75 ifies the permissions required for access to the file itself. Directo‐
76 ries have an additional ACL (ARCHIVE_ENTRY_ACL_TYPE_DEFAULT), which con‐
77 trols the initial access ACL for newly created directory entries.
78
79 archive_entry_acl_add_entry() and archive_entry_acl_add_entry_w() add a
80 single ACL entry. For the access ACL and non-extended principals, the
81 classic Unix permissions are updated.
82
83 archive_entry_acl_clear() removes all ACL entries and resets the enumera‐
84 tion pointer.
85
86 archive_entry_acl_count() counts the ACL entries that have the given type
87 mask. type can be the bitwise-or of ARCHIVE_ENTRY_ACL_TYPE_ACCESS and
88 ARCHIVE_ENTRY_ACL_TYPE_DEFAULT. If ARCHIVE_ENTRY_ACL_TYPE_ACCESS is
89 included and at least one extended ACL entry is found, the three non-
90 extened ACLs are added.
91
92 archive_entry_acl_next() and archive_entry_acl_next_w() return the next
93 entry of the ACL list. This functions may only be called after
94 archive_entry_acl_reset() has indicated the presence of extended ACL
95 entries.
96
97 archive_entry_acl_reset() prepare reading the list of ACL entries with
98 archive_entry_acl_next() or archive_entry_acl_next_w(). The function
99 returns either 0, if no non-extended ACLs are found. In this case, the
100 access permissions should be obtained by archive_entry_mode(3) or set
101 using chmod(2). Otherwise, the function returns the same value as
102 archive_entry_acl_count().
103
104 archive_entry_acl_text_w() converts the ACL entries for the given type
105 mask into a wide string. In addition to the normal type flags,
106 ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID and ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
107 can be specified to further customize the result. The returned long
108 string is valid until the next call to archive_entry_acl_clear(),
109 archive_entry_acl_add_entry(), archive_entry_acl_add_entry_w() or
110 archive_entry_acl_text_w().
111
113 archive_entry_acl_count() and archive_entry_acl_reset() returns the num‐
114 ber of ACL entries that match the given type mask. If the type mask
115 includes ARCHIVE_ENTRY_ACL_TYPE_ACCESS and at least one extended ACL
116 entry exists, the three classic Unix permissions are counted.
117
118 archive_entry_acl_next() and archive_entry_acl_next_w() return ARCHIVE_OK
119 on success, ARCHIVE_EOF if no more ACL entries exist and ARCHIVE_WARN if
120 archive_entry_acl_reset() has not been called first.
121
122 archive_entry_text_w() returns a wide string representation of the ACL
123 entrise matching the given type mask. The returned long string is valid
124 until the next call to archive_entry_acl_clear(),
125 archive_entry_acl_add_entry(), archive_entry_acl_add_entry_w() or
126 archive_entry_acl_text_w().
127
129 archive(3), archive_entry(3)
130
132 ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID and ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
133 are not documented.
134
135BSD February 2, 2012 BSD