Opens or closes the authentication database.
#include <userpw.h>
int setpwdb (Mode) int Mode;
int endpwdb ( )
These functions are used to open and close access to the authentication database. Programs that call either the getuserpw or putuserpw subroutine should call the setpwdb subroutine to open the database and the endpwdb subroutine to close the database.
The setpwdb subroutine opens the authentication database in the specified mode, if it is not already open. The open count is increased by 1.
The endpwdb subroutine decreases the open count by one and closes the authentication database when this count drops to 0. Subsequent references to individual data items can cause a memory access violation. The endpwdb subroutine also frees the space that was allocated by either the getuserpw, putuserpw, or putuserpwhist subroutine. For security reasons, freeing the space clears the password field. Any uncommitted changed data is lost.
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 setpwdb and endpwdb 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 setpwdb and endpwdb subroutines fail if the following is true:
EACCES | Access permission is denied for the data request. |
Both of these functions return errors from other subroutines.
Access Control: The calling process must have access to the authentication data.
Modes | File |
---|---|
rw | /etc/security/passwd |
rw | /etc/passwd |
These subroutines are part of Base Operating System (BOS) Runtime.
The getgroupattr subroutine, getuserattr subroutine, getuserpw, putuserpw, or putuserpwhist subroutine.
List of Security and Auditing Subroutines, Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.