Sets the current process credentials.
Security Library (libc.a)
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.
|User||Specifies the user for whom credentials are being established.|
|Credentials|| Defines specific credentials to be established. This parameter points to an array of null-terminated character strings that may contain the following values. The last character string must be null.
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:
|EINVAL||The Credentials parameter contains invalid credentials specifications.|
|EINVAL||The User parameter is null and the Credentials parameter is either null or points to an empty string.|
|EPERM||The process does not have the proper authority to set the requested credentials.|
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 subroutine.
List of Security and Auditing Subroutines, Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.