#include <rpc/rpc.h>
AUTH *authsys_create(const char *host,
const uid_t uid,
const gid_t gid,
const int len,
const gid_t *aup_gids);
The authsys_create() function creates and returns an RPC authentication handle that contains authentication information.
No authorization is required.
| auth | Upon successful completion, this API returns an RPC authentication handle. |
| NULL | authsys_create() was not successful. The errno variable is set to indicate the reason. |
| [EINVAL] | An invalid len parameter was passed. |
| [ENOMEM] | Storage allocation failed. |
| [EUNKNOWN] | Unknown system state. |
| Message ID | Error Message Text |
|---|---|
| CPIA1B0 I | An authentication problem was encountered by one of the TI-RPC APIs. |
| CPDA1C1 D | An authentication problem has occurred. |
| CPE3418 E | Possible APAR condition or hardware failure. |
| CPF3CF2 E | Error(s) occurred during running of &1 API. |
| CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
See Code disclaimer information for information pertaining to code examples.
The following example shows how authsys_create() is used:
#include <stdio.h>
#include <rpc/rpc.h>
/* Define remote program number and version */
#define RMTPROGNUM (u_long)0x3fffffffL
#define RMTPROGVER (u_long)0x1
main()
{
CLIENT *client; /* The client handle */
char *host;
uid_t uid;
gid_t gid, *aup_gids;
int len;
/* Service request to host RPCSERVER_HOST */
client = clnt_create("RPCSERVER_HOST", RMTPROGNUM, RMTPROGVER,
"tcp");
if (client == (CLIENT *)NULL) {
printf("Could not create client\n");
exit(1);
}
...
uid = geteuid();
gid = getegid();
len = getgroups(NGRPS, aup_gids));
/* Initialized the authsys_create()'s arguments before use */
client->cl_auth = authsys_create(host, uid, gid,
len, aup_gids);
if (client->cl_auth == (AUTH *)NULL) {
fprintf(stderr, "authsys_create failed!!\n");
exit(1);
}
...
}
| Top | Remote Procedure Call (RPC) APIs | APIs by category |