setuserdb or enduserdb Subroutine
Purpose
Opens and closes the user database.
Library
Security Library (libc.a)
Syntax
Description
These functions may be used to open and close access to the user database. Programs that call either the getuserattr or getgroupattr subroutine should call the setuserdb subroutine to open the user database and the enduserdb subroutine to close the user database.
The setuserdb subroutine opens the user database in the specified mode, if it is not already open. The open count is increased by 1.
The enduserdb subroutine decreases the open count by 1 and closes the user database when this count goes to 0. Any uncommitted changed data is lost.
Parameters
Item | Description |
---|---|
Mode | Specifies the
mode of the open. This parameter may contain
one or more of the following values defined in the usersec.h file:
|
Return Values
The setuserdb and enduserdb subroutines return a value of 0 to indicate success. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
Error Codes
The setuserdb subroutine fails if the following is true:
Item | Description |
---|---|
EACCES | Access permission is denied for the data request. |
Both subroutines return errors from other subroutines.
Security
Files Accessed: The calling process must have access to the user data. Depending on the actual attributes accessed, this may include:
Item | Description |
---|---|
Modes | File |
rw | /etc/passwd |
rw | /etc/group |
rw | /etc/security/user |
rw | /etc/security/limits |
rw | /etc/security/group |
rw | /etc/security/environ |