Opens and closes the user database.
#include <usersec.h>
int setuserdb ( Mode)
int Mode;
int enduserdb ( )
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.
Note: These subroutines are not safe for use with multiple threads. To call one of these subroutines from a threaded application, enclose the call with the _libs_rmutex lock. See "Making a Subroutine Safe for Multiple Threads" in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs for more information about this lock.
Mode | Specifies the mode of the open. This parameter may contain one or more of the following values defined in the usersec.h file: |
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.
The setuserdb
subroutine fails if the following is true:
EACCES | Access permission is denied for the data request. |
Both subroutines return errors from other subroutines.
Files Accessed: The calling
process must have access to the user data. Depending on the actual
attributes accessed, this may include:
Modes | File |
rw | /etc/passwd |
rw | /etc/group |
rw | /etc/security/user |
rw | /etc/security/limits |
rw | /etc/security/group |
rw | /etc/security/environ |
These subroutines are part of Base Operating System (BOS) Runtime.
The getgroupattr subroutine, getuserattr subroutine, getuserpw subroutine, setpwdb (setpwdb or endpwdb Subroutine) subroutine.
List of Security and Auditing Subroutines and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.