auth_destroy Macro

Important: The macro is exported from both the libc and the libnsl libraries.

auth_destroy Macro Exported from the libc Library

Purpose

Destroys authentication information.

Library

C Library (libc.a)

Syntax

#include <rpc/rpc.h>

void auth_destroy ( auth)
auth *auth;

Description

The auth_destroy macro destroys the authentication information structure pointed to by the auth parameter. Destroying the structure deallocates private data structures. The use of the auth parameter is undefined after calling this macro.

Parameters

Item Description
auth Points to the authentication information structure to be destroyed.

auth_destroy Macro Exported from the libnsl Library

Purpose

Destroys authentication information.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpc.h>
void auth_destroy ( auth)
AUTH *auth;

Description

The auth_destroy macro destroys the client authentication information associated with the auth parameter. The auth parameter, which points to an authentication structure that is present in the client handle (the cl_auth field), is passed to the server when a remote procedure call (RPC) is made. The private data structures are deallocated when the authentication information structure is destroyed. The usage of the auth parameter is undefined after a call to this macro.

Parameters

Item Description
auth Points to the authentication information structure to be destroyed.

Examples

#include <rpc/rpc.h>
#include <stdio.h>

int main()
{
  rpcprog_t PROGNUM = 0x3fffffffL;
  rpcvers_t PROGVER = 0x1L ;
  char *nettype = "visible";
  char hostname[255] ;      /* The name of remote host */
  AUTH  *auth

  /* Create client handle */
  if ((cl=clnt_create( hostname, PROGNUM, PROGVER, nettype)) == NULL)
  {
    fprintf(stdout, "clnt_create : failed.\n");
    exit(EXIT_FAILURE);
  }

  /* Create default authentication structure */ 
  auth = authsys_create_default();
  cl->cl_auth = auth;

  /* 
   * Make a CLNT_CALL 
   */

  /* Destroy the authentication information */
  auth_destroy(cl->cl_auth);

  /* Destroy the client handle */
  clnt_destroy(cl);
 
  return 0;
}