acl_get_file, acl_set_file - get or set the ACL for a pathname
acl_get_file returns a pointer to an allocated struct acl associated with the pathname pointed to by path. type determines whether the default ACL (type == ACL_TYPE_DEFAULT) or access ACL (type == ACL_TYPE_ACCESS) is returned. The default ACL is available only for directories. If there is no default ACL associated with the specified directory, an ACL containing zero entries is returned. If _POSIX_MAC is in effect, then the process must have MAC read access to the object.
acl_set_file sets the ACL of the specified pathname. type indicates which ACL, default or access, is to be set. Only directories can have a default ACL. If type is not valid, the call fails. The ACL is first checked for validity by acl_valid(3). The effective UID of the process must match the owner of the object or the process must have appropriate privilege to set the access ACL or the default ACL on path. If _POSIX_CAP is in effect, then the appropriate capability must include CAP_FOWNER. In addition, if _POSIX_MAC is in effect, then the process must have MAC write access to the object.
acl_get_file a pointer to an allocated struct acl if successful, NULL otherwise. The storage should be freed with a call to acl_free with the returned pointer as an argument when it is no longer needed.
acl_set_file returns 0 if successful, 1 otherwise.
|
acl_get_file: |
|||
|
EACCESS |
Search permission is denied for a component of the path prefix or the object exists and the process does not have appropriate access rights. |
||
|
EINVAL |
type is not valid |
ENAMETOLONG
|
The pathname or one of its components is too long. |
|||
|
ENOENT ENOMEM ENOSYS ENOTDIR acl_set_file: |
The named object does not exist or path points to an empty string. allocation of the struct acl failed. ACL support is not available (not installed). A component of the path prefix is not a directory. |
||
|
EACCESS |
Search permission is denied for a component of the path prefix or the object exists and the process does not have appropriate access rights. |
||
|
EINVAL |
aclp points to an invalid ACL. type is not either ACL_TYPE_ACCESS, or ACL_TYPE_DEFAULT. The ACL is too large (too many entries). |
ENAMETOLONG
|
The pathname or one of its components is too long. |
|||
|
ENOENT ENOSPC |
The named object does not exist or path points to an empty string. The file system is full or some other resource needed for the ACL storage is not available. |
||
|
ENOSYS ENOTDIR EPERM |
ACL support is not available (not installed). A component of the path prefix is not a directory. The process does not have appropriate privilege to perform the operation to set the ACL. |
||
|
EROFS |
This function requires modification of a file system which is currently readonly. |