Accesses the user authentication data.
Security Library (libc.a)
#include <userpw.h>
int putuserpwx (Password)
struct userpwx *Password;
The putuserpwx subroutine modifies user authentication information. It can be used with those administrative domains that support modifying the user's encrypted password with the putuserattrs subroutine. The chpassx subroutine must be used to modify authentication information for administrative domains that do not support that functionality.
The putuserpwx subroutine updates or creates password authentication data for the user defined in the Password parameter in the administrative domain that is specified. The password entry created by the putuserpwx subroutine is used only if there is an ! (exclamation point) in the user's password (S_PWD) attribute. The user application can use the putuserattrs subroutine to add an ! to this field.
The putuserpwx subroutine opens the authentication database read-write if no other access has taken place, but the program should call setpwdb (S_READ | S_WRITE) before calling the putuserpwx subroutine and endpwdb when access to the authentication information is no longer required.
The administrative domain specified in the upw_authdb field is set by the getuserpwx subroutine. It must be specified by the application program if the getuserpwx subroutine is not used to produce the Password parameter.
Item | Description |
---|---|
Password | Specifies the password structure used to update the password
information for this user. The fields in a userpwx structure
are defined in the userpw.h file and contains the following
members:
|
Files accessed:
Item | Description |
---|---|
Mode | File |
rw | /etc/security/passwd |
If successful, the putuserpwx subroutine returns a value of 0. If the subroutine failed to update or create the password information, the putuserpwx subroutine returns a nonzero value.
The getuserpwx subroutine fails if the following value is true:
Item | Description |
---|---|
ENOENT | The user does not have an entry in the /etc/security/passwd file. |
Subroutines invoked by the putuserpwx subroutine can also set errors.
Item | Description |
---|---|
/etc/security/passwd | Contains user passwords. |