Sets the current process credentials.
#include <usersec.h>
int setpcred ( User, Credentials)
char **Credentials;
char *User;
The setpcred subroutine sets a process' credentials according to the Credentials parameter. If the User parameter is specified, the credentials defined for the user in the user database are used. If the Credentials parameter is specified, the credentials in this string are used. If both the User and Credentials parameters are specified, both the user's and the supplied credentials are used. However, the supplied credentials of the Credentials parameter will override those of the user. At least one parameter must be specified.
The setpcred subroutine requires the setpenv subroutine to follow it.
Note: If the auditwrite subroutine is to be called from a program invoked from the inittab file, the setpcred subroutine should be called first to establish the process' credentials.
The soft limit credentials will override the equivalent hard limit credentials that may proceed them. To set the hard limits, the hard limit credentials should follow the soft limit credentials.
Upon successful return, the setpcred subroutine returns a value of 0. If setpcred fails, a value of -1 is returned and the errno global variable is set to indicate the error.
The setpcred
subroutine fails if one or more of the following are true:
Other errors may be set by subroutines invoked by the setpcred subroutine.
This subroutine is part of Base Operating System (BOS) Runtime.
The auditwrite subroutine, ckuseracct subroutine, ckuserID subroutine, getpcred subroutine, getpenv subroutine, setpenv (setpenv Subroutine) subroutine.
List of Security and Auditing Subroutines, Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.