getaccess.2 (2010 09)

g
getaccess(2) getaccess(2)
access() getaccess()
Checks all ACL entries (HFS and JFS File
Systems only)
Same
Uses real uid, real gid, and supplementary
groups list
Uses specified uid and groups list; macros
available for typical values
Checks specific mode value, returns
succeed or fail
Returns all mode bits, each on or off
Checks path to file using caller’s effective
IDs
Same
W_OK false if shared-text file currently
being executed
Same
W_OK false if file on read-only file system Same
X_OK not modified for file currently open
for writing
Same
R_OK and W_OK always true for superuser
(except as described in Security Restric-
tions) or users with DAC_READ and
DAC_WRITE privileges.
Same
X_OK always true for superuser or users
with DAC_READ and DAC_WRITE
privileges. See privileges (5) for more
information about privileged access on
systems that support fine-grained
privileges.
X_OK true for superuser or users with
DAC_READ and DAC_WRITE privilege if
file is not a regular:file or execute is set in.
See privileges (5) for more information
about privileged access on systems that
support fine-grained privileges.
Security Restrictions
If the caller’s user ID is 0, or has the
DACREAD and DACWRITE privilege, or if it is UID_EUID,
UID_RUID,orUID_SUID (see <sys/getaccess.h>
) and the process’s respective user ID is 0, R_OK
and W_OK are always set except when W_OK is cleared for files on read-only file systems or shared-text
programs being executed. X_OK is set if and only if the file is not a regular file or the execute bit is set in
any of the file’s ACL entries.
See privileges (5) for more information about privileged access on systems that support fine-grained
privileges.
RETURN VALUE
getaccess() returns the following values:
>0 Successful completion. Returns a non-negative value representing the access rights of the
specified user to the specified file.
-1 Failure. errno is set to indicate the error.
ERRORS
getaccess() fails if any of the following conditions are encountered:
[EACCES] A component of the path prefix denies search permission to the caller.
[EFAULT] path or gidset points outside the allocated address space of the process.
The reliable detection of this error is implementation dependent.
[EINVAL] ngroups is invalid; ngroups is either zero, an unrecognized negative value,
or a value larger than
sysconf(_SC_NGROUPS_MAX) +1.
[EINVAL] gidset contains an invalid group ID value.
[EINVAL] The value of label or privs is not a null pointer.
[ELOOP] Too many symbolic links were encountered in translating the path name.
[ENAMETOOLONG] The length of the specified path name exceeds
PATH_MAX bytes, or the
length of a component of the path name exceeds NAME_MAX bytes while
_POSIX_NO_TRUNC is in effect.
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010