[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1


acl_chg or acl_fchg Subroutine

Purpose

Changes the access control information on a file.

Library

Security Library (libc.a)

Syntax

#include <sys/access.h>


int acl_chg (PathHowModeWho)
char * Path;
int  How;
int  Mode;
int  Who;


int acl_fchg (FileDescriptor, How, ModeWho)
int  FileDescriptor;
int How;
int Mode;
int Who;

Description

The acl_chg and acl_fchg subroutines modify the access control information of a specified file.

Parameters


FileDescriptor Specifies the file descriptor of an open file.
How Specifies how the permissions are to be altered for the affected entries of the Access Control List (ACL). This parameter takes one of the following values:

ACC_PERMIT
Allows the types of access included in the Mode parameter.

ACC_DENY
Denies the types of access included in the Mode parameter.

ACC_SPECIFY
Grants the access modes included in the Mode parameter and restricts the access modes not included in the Mode parameter.
Mode Specifies the access modes to be changed. The Mode parameter is a bit mask containing zero or more of the following values:

R_ACC
Allows read permission.

W_ACC
Allows write permission.

X_ACC
Allows execute or search permission.
Path Specifies a pointer to the path name of a file.
Who Specifies which entries in the ACL are affected. This parameter takes one of the following values:

ACC_OBJ_OWNER
Changes the owner entry in the base ACL.

ACC_OBJ_GROUP
Changes the group entry in the base ACL.

ACC_OTHERS
Changes all entries in the ACL except the base entry for the owner.

ACC_ALL
Changes all entries in the ACL.

Return Values

On successful completion, the acl_chg and acl_fchg subroutines return a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

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

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_fchg subroutine fails and the file permissions remain unchanged if the following is true:

EBADF The FileDescriptor value is not valid.

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

EINVAL The How parameter is not one of ACC_PERMIT, ACC_DENY, or ACC_SPECIFY.
EINVAL The Who parameter is not ACC_OWNER, ACC_GROUP, ACC_OTHERS, or ACC_ALL.
EROFS The named file resides on a read-only file system.

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

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.

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

ETIMEDOUT The connection timed out.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The acl_get (acl_get or acl_fget Subroutine) subroutine, acl_put (acl_put or acl_fput Subroutine) subroutine, acl_set (acl_set or acl_fset Subroutine) subroutine, chacl (chacl or fchacl Subroutine) subroutine, chmod (chmod or fchmod Subroutine) subroutine, stat subroutine, statacl subroutine.

The aclget command, aclput command, chmod command.

List of Security and Auditing Subroutines and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]