acl_set or acl_fset Subroutine

Purpose

Sets the AIXC ACL type access control information of a file.

Library

Security Library (libc.a)

Syntax

#include <sys/access.h>

int acl_set (PathOwnerModeGroupModeDefaultMode)
char * Path;
int  OwnerMode;
int  GroupMode;
int  DefaultMode;

int acl_fset (FileDescriptor, OwnerModeGroupModeDefaultMode)
int * FileDescriptor;
int OwnerMode;
int GroupMode;
int DefaultMode;

Description

The acl_set and acl_fset subroutines set the base entries of the Access Control List (ACL) of the file. All other entries are discarded. Other access control attributes are left unchanged. Note that if the file system object is associated with any other ACL type access control information, it will be replaced with just the Base mode bits information. It is strongly recommended that applications stop using these interfaces and instead make use of aclx_put and aclx_fput subroutines to set the ACL.

Parameters

Item Description
DefaultMode Specifies the access permissions for the default class.
FileDescriptor Specifies the file descriptor of an open file.
GroupMode Specifies the access permissions for the group of the file.
OwnerMode Specifies the access permissions for the owner of the file.
Path Specifies a pointer to the path name of a file.

The mode parameters specify the access permissions in a bit mask containing zero or more of the following values:

Item Description
R_ACC Authorize read permission.
W_ACC Authorize write permission.
X_ACC Authorize execute or search permission.

Return Values

Upon successful completion, the acl_set and acl_fset subroutines return the value 0. Otherwise, the value -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The acl_set subroutine fails and the access control information for a file remains unchanged if one or more of the following are true:

Item Description
EACCES Search permission is denied on a component of the Path prefix.
EFAULT The Path parameter points to a location outside of the allocated address space of the process.
ELOOP Too many symbolic links were encountered in translating the Path parameter.
ENAMETOOLONG A component of the Path parameter exceeded 255 characters, or the entire Path parameter exceeded 1023 characters.
ENOENT A component of the Path does not exist or has the disallow truncation attribute (see the ulimit subroutine).
ENOENT The Path parameter was null.
ENOENT A symbolic link was named, but the file to which it refers does not exist.
ENOTDIR A component of the Path prefix is not a directory.
ESTALE The process' root or current directory is located in a virtual file system that has been unmounted.

The acl_fset subroutine fails and the file permissions remain unchanged if the following is true:

Item Description
EBADF The file descriptor FileDescriptor is not valid.

The acl_set or acl_fset subroutine fails and the access control information for a file remains unchanged if one or more of the following are true:

Item Description
EIO An I/O error occurred during the operation.
EPERM The effective user ID does not match the ID of the owner of the file and the invoker does not have root user authority.
EROFS The named file resides on a read-only file system.

If Network File System (NFS) is installed on your system, the acl_set and acl_fset subroutines can also fail if the following is true:

Item Description
ETIMEDOUT The connection timed out.

Security

Access Control: The invoker must have search permission for all components of the Path prefix.

Auditing Events:

Event Information
chacl Path
fchacl FileDescriptor