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



Error Conditions



Error Messages



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 ]