1 .\" Copyright (c) 2010 Joerg Sonnenberger
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .Dt ARCHIVE_ENTRY_ACL 3
29 .Nm archive_entry_acl_add_entry ,
30 .Nm archive_entry_acl_add_entry_w ,
31 .Nm archive_entry_acl_clear ,
32 .Nm archive_entry_acl_count ,
33 .Nm archive_entry_acl_next ,
34 .Nm archive_entry_acl_next_w ,
35 .Nm archive_entry_acl_reset ,
36 .Nm archive_entry_acl_text_w
37 .Nd functions for manipulating Access Control Lists in archive entry descriptions
39 Streaming Archive Library (libarchive, -larchive)
43 .Fo archive_entry_acl_add_entry
44 .Fa "struct archive_entry *a"
49 .Fa "const char *name"
52 .Fo archive_entry_acl_add_entry_w
53 .Fa "struct archive_entry *a"
58 .Fa "const wchar_t *name"
61 .Fn archive_entry_acl_clear "struct archive_entry *a"
63 .Fn archive_entry_acl_count "struct archive_entry *a" "int type"
65 .Fo archive_entry_acl_next
66 .Fa "struct archive_entry *a"
69 .Fa "int *ret_permset"
72 .Fa "const char **ret_name"
75 .Fo archive_entry_acl_next_w
76 .Fa "struct archive_entry *a"
79 .Fa "int *ret_permset"
82 .Fa "const wchar_t **ret_name"
85 .Fn archive_entry_acl_reset "struct archive_entry *a" "int type"
87 .Fn archive_entry_acl_text_w "struct archive_entry *a" "int flags"
91 .Dq Access Control List
92 is a generalisation of the classic Unix permission system.
95 is derived from the POSIX.1e draft, but restricted to simplify dealing
96 with practical implementations in various Operating Systems and archive formats.
98 An ACL consists of a number of independent entries.
99 Each entry specifies the permission set as bitmask of basic permissions.
100 Valid permissions are:
101 .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_EXECUTE"
102 .It Dv ARCHIVE_ENTRY_ACL_EXECUTE
103 .It Dv ARCHIVE_ENTRY_ACL_WRITE
104 .It Dv ARCHIVE_ENTRY_ACL_READ
106 The permissions correspond to the normal Unix permissions.
108 The tag specifies the principal to which the permission applies.
110 .Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
111 .It Dv ARCHIVE_ENTRY_ACL_USER
112 The user specified by the name field.
113 .It Dv ARCHIVE_ENTRY_ACL_USER_OBJ
114 The owner of the file.
115 .It Dv ARCHIVE_ENTRY_ACL_GROUP
116 The group specied by the name field.
117 .It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
118 The group who owns the file.
119 .It Dv ARCHIVE_ENTRY_ACL_MASK
120 The maximum permissions to be obtained via group permissions.
121 .It Dv ARCHIVE_ENTRY_ACL_OTHER
122 Any principal who doesn't have a user or group entry.
125 .Dv ARCHIVE_ENTRY_ACL_USER_OBJ ,
126 .Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
128 .Dv ARCHIVE_ENTRY_ACL_OTHER
129 are equivalent to user, group and other in the classic Unix permission
130 model and specify non-extended ACL entries.
132 All files have an access ACL
133 .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS .
134 This specifies the permissions required for access to the file itself.
135 Directories have an additional ACL
136 .Pq Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT ,
137 which controls the initial access ACL for newly created directory entries.
139 .Fn archive_entry_acl_add_entry
141 .Fn archive_entry_acl_add_entry_w
142 add a single ACL entry.
143 For the access ACL and non-extended principals, the classic Unix permissions
146 .Fn archive_entry_acl_clear
147 removes all ACL entries and resets the enumeration pointer.
149 .Fn archive_entry_acl_count
150 counts the ACL entries that have the given type mask.
152 can be the bitwise-or of
153 .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
155 .Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT .
157 .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
158 is included and at least one extended ACL entry is found,
159 the three non-extened ACLs are added.
161 .Fn archive_entry_acl_next
163 .Fn archive_entry_acl_next_w
164 return the next entry of the ACL list.
165 This functions may only be called after
166 .Fn archive_entry_acl_reset
167 has indicated the presence of extended ACL entries.
169 .Fn archive_entry_acl_reset
170 prepare reading the list of ACL entries with
171 .Fn archive_entry_acl_next
173 .Fn archive_entry_acl_next_w .
174 The function returns either 0, if no non-extended ACLs are found.
175 In this case, the access permissions should be obtained by
176 .Xr archive_entry_mode 3
179 Otherwise, the function returns the same value as
180 .Fn archive_entry_acl_count .
182 .Fn archive_entry_acl_text_w
183 converts the ACL entries for the given type mask into a wide string.
184 In addition to the normal type flags,
185 .Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
187 .Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
188 can be specified to further customize the result.
189 The returned long string is valid until the next call to
190 .Fn archive_entry_acl_clear ,
191 .Fn archive_entry_acl_add_entry ,
192 .Fn archive_entry_acl_add_entry_w
194 .Fn archive_entry_acl_text_w .
196 .Fn archive_entry_acl_count
198 .Fn archive_entry_acl_reset
199 returns the number of ACL entries that match the given type mask.
200 If the type mask includes
201 .Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
202 and at least one extended ACL entry exists, the three classic Unix
203 permissions are counted.
205 .Fn archive_entry_acl_next
207 .Fn archive_entry_acl_next_w
212 if no more ACL entries exist
216 .Fn archive_entry_acl_reset
217 has not been called first.
219 .Fn archive_entry_text_w
220 returns a wide string representation of the ACL entrise matching the
222 The returned long string is valid until the next call to
223 .Fn archive_entry_acl_clear ,
224 .Fn archive_entry_acl_add_entry ,
225 .Fn archive_entry_acl_add_entry_w
227 .Fn archive_entry_acl_text_w .
232 .Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
234 .Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT