acl_from_text()

Updated: April 19, 2023

Create an access control list (ACL) from text

Synopsis:

#include <sys/acl.h>

acl_t acl_from_text( const char *buf_p );

Arguments:

buf_p
A pointer to a buffer that contains the text form of the ACL that you want to convert.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The acl_from_text() function converts an access control list from text form into the internal form of an ACL. This function accepts the long and short text forms of an ACL:

tag_type:qualifier:permissions

In the long form, tag_type is user, group, other, or mask, the qualifier is an empty string or the name or numeric ID of a user or group, and the permissions are in the form rwx, with a hyphen (-) replacing any permissions that aren't granted.

Entry type Tag type constant Form
Owner ACL_USER_OBJ user::permissions
Named user (identified by name or by numerical ID) ACL_USER user:user_identifier:permissions
Owning group ACL_GROUP_OBJ group::permissions
Named group (identified by name or numerical ID) ACL_GROUP group:group_identifier:permissions
The upper bound on permissions for the group class ACL_MASK mask::permissions
Others ACL_OTHER other::permissions

In the short form, you can abbreviate the tag_type to its first letter, and the permissions can contain at most one each of r, w, and x, in any order.

When you're finished with the resulting ACL, you should call acl_free() to release it.

Returns:

A pointer to the internal representation of the ACL, or NULL if an error occurred (errno is set).

Errors:

EINVAL
The contents of the buffer couldn't be converted into an ACL.
ENOMEM
There wasn't enough memory available to allocate for the ACL in working storage.

Classification:

QNX Neutrino

This function is based on the withdrawn POSIX draft P1003.1e.

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes