authsys_create()--Create Authentication with OS Permission


  Syntax

 #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);

  Default Public Authority: *USE

  Service Program Name: QZNFTRPC

  Threadsafe: No

The authsys_create() function creates and returns an RPC authentication handle that contains authentication information.


Parameters

host  (Input) 
A pointer to the name of the machine on which the permission was created.

uid  (Input) 
The caller's effective user ID (UID).

gid  (Input) 
The caller's effective group ID (GID).

len  (Input) 
The length of the group's array.

aup_gids  (Input) 
A pointer to the counted array of groups to which the user belongs.

Authorities

No authorization is required.


Return Value

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.


Error Conditions

[EINVAL] An invalid len parameter was passed.
[ENOMEM] Storage allocation failed.
[EUNKNOWN] Unknown system state.


Error Messages

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.


Related Information


Example

The following example shows how authsys_create() is used.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#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);
  }

  ...

}

API introduced: V4R2

[ Back to top | Remote Procedure Call (RPC) APIs | APIs by category ]