2 .\" Copyright (c) 20068 Sun Microsystems, Inc. All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ACL_TOTEXT 3SEC "Jun 16, 2008"
8 acl_totext, acl_fromtext \- convert internal representation to or from
9 external representation
13 cc [ \fIflag\fR\&.\|.\|. ] \fIfile\fR\&.\|.\|. \fB-lsec\fR [ \fIlibrary\fR\&.\|.\|. ]
16 \fBchar *\fR\fBacl_totext\fR(\fBacl_t *\fR\fIaclp\fR, \fBint\fR \fIflags\fR);
21 \fBint\fR \fBacl_fromtext\fR(\fBchar *\fR\fIacltextp\fR, \fBacl_t **\fR\fIaclp\fR);
27 The \fBacl_totext()\fR function converts an internal ACL representation pointed
28 to by \fIaclp\fR into an external ACL representation. The memory for the
29 external text string is obtained using \fBmalloc\fR(3C). The caller is
30 responsible for freeing the memory upon completion.
33 The format of the external ACL is controlled by the \fIflags\fR argument.
34 Values for \fIflags\fR are constructed by a bitwise-inclusive-OR of \fIflags\fR
35 from the following list, defined in <\fBsys/acl.h\fR>.
39 \fB\fBACL_COMPACT_FMT\fR\fR
42 For NFSv4 ACLs, the ACL entries will be formatted using the compact ACL format
43 detailed in \fBls\fR(1) for the \fB-V\fR option.
49 \fB\fBACL_APPEND_ID\fR\fR
52 Append the \fBuid\fR or \fBgid\fR for additional user or group entries. This
53 flag is used to construt ACL entries in a manner that is suitable for archive
54 utilities such as \fBtar\fR(1). When the ACL is translated from the external
55 format to internal representation using \fBacl_fromtext()\fR, the appended ID
56 will be used to populate the \fBuid\fR or \fBgid\fR field of the ACL entry when
57 the user or group name does not exist on the host system. The appended id will
58 be ignored when the user or group name does exist on the system.
64 \fB\fBACL_SID_FMT\fR\fR
67 For NFSv4 ACLs, the ACL entries for user or group entries will use the
68 \fBusersid\fR or \fBgroupsid\fR format when the "id" field in the ACL entry is
69 an ephemeral \fBuid\fR or \fBgid\fR. The raw \fBsid\fR format will only be
70 used when the "id" cannot be resolved to a windows name.
75 The \fBacl_fromtext()\fR function converts an external ACL representation
76 pointed to by \fIacltextp\fR into an internal ACL representation. The memory
77 for the list of ACL entries is obtained using \fBmalloc\fR(3C). The caller is
78 responsible for freeing the memory upon completion. Depending on type of ACLs a
79 file system supports, one of two external external representations are
80 possible. For POSIX draft file systems such as ufs, the external representation
81 is described in \fBacltotext\fR(3SEC). The external ACL representation For
82 NFSv4-style ACLs is detailed as follows.
85 Each \fBacl_entry\fR contains one ACL entry. The external representation of an
86 ACL entry contains three, four or five colon separated fields. The first field
87 contains the ACL entry type. The entry type keywords are defined as:
94 This ACL entry specifies the access granted to any user or group that does not
95 match any previous ACL entry.
104 This ACL entry with a GID specifies the access granted to a additional group of
114 This ACL entry with no GID specified in the ACL entry field specifies the
115 access granted to the owning group of the object.
124 This ACL entry with a SID or Windows name specifies the access granted to a
125 Windows group. This type of entry is for a CIFS server created file.
134 This ACL entry with no UID specified in the ACL entry field specifies the
135 access granted to the owner of the object.
144 This ACL entry with a SID or Windows name when the entry could be either a
154 This ACL entry with a UID specifies the access granted to a additional user of
164 This ACL entry with a SID or Windows name specifies the access granted to a
165 Windows user. This type of entry is for a CIFS server created file.
170 The second field contains the ACL entry ID, and is used only for user or group
171 ACL entries. This field is not used for \fBowner@\fR, \fBgroup@\fR, or
172 \fBeveryone@\fR entries.
179 This field contains a user-name or user-ID. If the user-name cannot be resolved
180 to a UID, then the entry is assumed to be a numeric UID.
189 This field contains a group-name or group-ID. If the group-name can't be
190 resolved to a GID, then the entry is assumed to be a numeric GID.
195 The third field contains the discretionary access permissions. The format of
196 the permissions depends on whether \fBACL_COMPACT_FMT\fR is specified. When the
197 \fIflags\fR field does not request \fBACL_COMPACT_FMT\fR, the following format
198 is used with a forward slash (/) separating the permissions.
205 Add a file to a directory.
211 \fB\fBadd_subdirectory\fR\fR
238 \fB\fBdelete_child\fR\fR
256 \fB\fBlist_directory\fR\fR
274 \fB\fBread_data\fR\fR
283 \fB\fBread_attributes\fR\fR
292 \fB\fBread_xattr\fR\fR
295 Read named attributes.
301 \fB\fBsynchronize\fR\fR
310 \fB\fBwrite_acl\fR\fR
319 \fB\fBwrite_attributes\fR\fR
328 \fB\fBwrite_data\fR\fR
337 \fB\fBwrite_owner\fR\fR
346 \fB\fBwrite_xattr\fR\fR
349 Write named attributes.
354 This format allows permissions to be specified as, for example:
355 \fBread_data\fR/\fBread_xattr\fR/\fBread_attributes\fR.
358 When \fBACL_COMPACT_FMT\fR is specified, the permissions consist of 14 unique
359 letters. A hyphen (-) character is used to indicate that the permission at
360 that position is not specified.
448 read named attributes
475 write named attributes
489 This format allows compact permissions to be represented as, for example:
493 The fourth field is optional when \fBACL_COMPACT_FMT\fR is not specified, in
494 which case the field will be present only when the ACL entry has inheritance
495 flags set. The following is the list of inheritance flags separated by a slash
500 \fB\fBdir_inherit\fR\fR
503 \fBACE_DIRECTORY_INHERIT_ACE\fR
509 \fB\fBfile_inherit\fR\fR
512 \fBACE_FILE_INHERIT_ACE\fR
518 \fB\fBinherit_only\fR\fR
521 \fBACE_INHERIT_ONLY_ACE\fR
527 \fB\fBno_propagate\fR\fR
530 \fBACE_NO_PROPAGATE_INHERIT_ACE\fR
535 When \fBACL_COMPACT_FMT\fR is specified the inheritance will always be present
536 and is represented as positional arguments. A hyphen (-) character is used to
537 indicate that the inheritance flag at that position is not specified.
562 failed access (not currently supported)
589 successful access (not currently supported)
594 The fifth field contains the type of the ACE (\fBallow\fR or \fBdeny\fR):
601 The mask specified in field three should be allowed.
610 The mask specified in field three should be denied.
616 Upon successful completion, the \fBacl_totext()\fR function returns a pointer
617 to a text string. Otherwise, it returns \fINULL\fR.
620 Upon successful completion, the \fBacl_fromtext()\fR function returns 0.
621 Otherwise, the return value is set to one of the following:
625 \fB\fBEACL_FIELD_NOT_BLANK\fR\fR
628 A field that should be blank is not blank.
634 \fB\fBEACL_FLAGS_ERROR\fR\fR
637 An invalid ACL flag was specified.
643 \fB\fBEACL_INHERIT_ERROR\fR\fR
646 An invalid inheritance field was specified.
652 \fB\fBEACL_INVALID_ACCESS_TYPE\fR\fR
655 An invalid access type was specified.
661 \fB\fBEACL_INVALID_STR\fR\fR
664 The string is \fINULL\fR.
670 \fB\fBEACL_INVALID_USER_GROUP\fR\fR
673 The required user or group name not found.
679 \fB\fBEACL_MISSING_FIELDS\fR\fR
682 The ACL needs more fields to be specified.
688 \fB\fBEACL_PERM_MASK_ERROR\fR\fR
691 The permission mask is invalid.
697 \fB\fBEACL_UNKNOWN_DATA\fR\fR
700 Unknown data was found in the ACL.
705 \fBExample 1 \fRExamples of permissions when \fBACL_COMPACT_FMT\fR is not
710 user:joe:read_data/write_data:file_inherit/dir_inherit:allow
718 owner@:read_acl:allow,user:tom:read_data:file_inherit/inherit_only:deny
724 \fBExample 2 \fRExamples of permissions when \fBACL_COMPACT_FMT\fR is
729 user:joe:rw------------:fd----:allow
737 owner@:----------c---:------allow,user:tom:r-------------:f-i---:deny
745 See \fBattributes\fR(5) for descriptions of the following attributes:
753 ATTRIBUTE TYPE ATTRIBUTE VALUE
755 Interface Stability Committed
763 \fBls\fR(1), \fBtar\fR(1), \fBacl\fR(2), \fBmalloc\fR(3C),
764 \fBaclfromtext\fR(3SEC), \fBacl\fR(5), \fBattributes\fR(5)