xref: /illumos-gate/usr/src/man/man3sec/acltotext.3sec (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
te
Copyright (c) 2001, Sun Microsystems, Inc.
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.
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.
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]
ACLTOTEXT 3SEC "Dec 10, 2001"
NAME
acltotext, aclfromtext - convert internal representation to or from external representation
SYNOPSIS
cc [ flag... ] file... -lsec [ library... ]
#include <sys/acl.h>

char *acltotext(aclent_t *aclbufp, int aclcnt);

aclent_t *aclfromtext(char *acltextp, int *aclcnt);
DESCRIPTION
The acltotext() function converts an internal ACL representation pointed to by aclbufp into an external ACL representation. The space for the external text string is obtained using malloc(3C). The caller is responsible for freeing the space upon completion.

The aclfromtext() function converts an external ACL representation pointed to by acltextp into an internal ACL representation. The space for the list of ACL entries is obtained using malloc(3C). The caller is responsible for freeing the space upon completion. The aclcnt argument indicates the number of ACL entries found.

An external ACL representation is defined as follows:

<acl_entry>[,<acl_entry>]\|.\|.\|.

Each <acl_entry> contains one ACL entry. The external representation of an ACL entry contains two or three colon-separated fields. The first field contains the ACL entry tag type. The entry type keywords are defined as: user

This ACL entry with no UID specified in the ACL entry ID field specifies the access granted to the owner of the object. Otherwise, this ACL entry specifies the access granted to a specific user-name or user-id number.

group

This ACL entry with no GID specified in the ACL entry ID field specifies the access granted to the owning group of the object. Otherwise, this ACL entry specifies the access granted to a specific group-name or group-id number.

other

This ACL entry specifies the access granted to any user or group that does not match any other ACL entry.

mask

This ACL entry specifies the maximum access granted to user or group entries.

default:user

This ACL entry with no uid specified in the ACL entry ID field specifies the default access granted to the owner of the object. Otherwise, this ACL entry specifies the default access granted to a specific user-name or user-ID number.

default:group

This ACL entry with no gid specified in the ACL entry ID field specifies the default access granted to the owning group of the object. Otherwise, this ACL entry specifies the default access granted to a specific group-name or group-ID number.

default:other

This ACL entry specifies the default access for other entry.

default:mask

This ACL entry specifies the default access for mask entry.

The second field contains the ACL entry ID, as follows: uid

This field specifies a user-name, or user-ID if there is no user-name associated with the user-ID number.

gid

This field specifies a group-name, or group-ID if there is no group-name associated with the group-ID number.

empty

This field is used by the user and group ACL entry types.

The third field contains the following symbolic discretionary access permissions: r

read permission

w

write permission

x

execute/search permission

-

no access

RETURN VALUES
Upon successful completion, the acltotext() function returns a pointer to a text string. Otherwise, it returns NULL.

Upon successful completion, the aclfromtext() function returns a pointer to a list of ACL entries. Otherwise, it returns NULL.

ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Evolving
MT-Level Unsafe
SEE ALSO
acl (2), malloc (3C), attributes (7)