rpc_gss_set_defaults Subroutine

Purpose

Changes the service type and quality of protection for client-server communication.

Library

Network Services Library (libnsl.a)

Syntax

#include <rpc/rpcsec_gss.h>
bool_t rpc_gss_set_defaults(auth_t, s_type, qop)
AUTH *auth_t;
rpc_gss_service_t s_type;
char *qop;

Description

While creating security context, you can specify the s_type and qop parameters for the transfer sessions. You can change the two parameters for next transfer sessions using the rpc_gss_set_defaults subroutine.

Parameters

Item Description
auth_t Represents an authentication handle returned by the rpc_gss_seccreate subroutine.
s_type Represents the type of service for the session that basically offers a level of protection. (for example, integrity and privacy).
qop Represents the quality of protection. You can specify the parameter to select cryptographic algorithm.

Return Values

Item Description
TRUE successful
FALSE unsuccessful

You can use the rpc_gss_get_error subroutine to retrieve the error number.

Examples

The following example uses the rpc_gss_set_defaults subroutine to set service type and quality of protection after security context creation.

#include <stdlib.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_gss.h>

main()
{
    CLIENT *client;
    rpc_gss_service_t service_type;
    char *qop;          
    rpc_gss_error_t gss_error;

    /* Create client handle using any of the client handle creation routines*/
   
    /* Create security context using rpc_gss_seccreate */
          
    /* Set service_type and quality of protection */
    if(rpc_gss_set_defaults(client->cl_auth,service_type,qop) == FALSE)
    {
        fprintf(stderr,"\nError in rpc_gss_set_defaults:\n");                    
        rpc_gss_get_error(&gss_error);
        fprintf(stderr,"rpc_gss_error: %d \nSystem_error: %d \n",
                gss_error.rpc_gss_error,gss_error.system_error);
        exit(EXIT_FAILURE);
    }
    /* Make a call to server */
}