acl_to_text() — Convert an ACL to text

Standards

Standards / Extensions C or C++ Dependencies

z/OS UNIX

both z/OS V1R3

Format

#define _OPEN_SYS	1
#include <sys/acl.h>

char *	acl_to_text (const lacl_t acl_d, ssize_t *len_p, acl_type_t type_d,
		char delim);	

General description

Use access control lists (ACLs) in conjunction with permission bits to control access to files and directories. Currently, ACLs are supported by the HFS, TFS, and zFS file systems. You must know whether your security product supports ACLs and what rules are used when determining file access. See z/OS UNIX System Services Planning for details.

The acl_to_text() function translates the extended ACL entries in an ACL pointed to by argument acl_d into a NULL terminated character string. This function allocates any memory necessary to contain the string and returns a pointer to the string. The memory allocated to contain the string must be freed. If the pointer len_p is not NULL, then the function returns the full length of the string (not including the NULL terminator) in the location pointed to by len_p. The delim parameter determines the delimiter used to separate the ACL entries (usually newline or comma).

The mask field in the base and extended ACL entry is ignored and only the ACL entry value field is used to display the ACL entry permissions.

For acl_d with no extended ACL entries, acl_to_text() returns NULL. When acl_to_text() cannot convert uid/gid to username/groupname, it leaves the uid/gid in the string.

The format of the text string:
<acl_entry>delim<acl_entry> ... <acl_entry>
where acl_entry may be:

base_acl_tag::permissions
user:user_name:permissions
group:group_name:permissions
default:user_name:permissions

base_acl_entry:
user, group, or other

permissions:
rwx  (with '-' for no permission)

default:
fdefault - file default
default - directory default

Returned value

Upon successful completion, the function returns a pointer to the text form of an ACL.

If any of the following conditions occur, the acl_to_text() returns NULL and sets errno to the corresponding value:

Error Code
Description
EINVAL
Argument acl_d does not point to a valid ACL structure. The ACL referenced by acl_d contains one or more improperly formed ACL entries, or for some other reason cannot be translated into the string form of ACL.
ENOMEM
The character string to be returned requires more memory than is available.

Related information