srv_negotiate

Description

Send to and receive from a client, negotiated login information.

Syntax

CS_RETCODE srv_negotiate(spp, cmd, type)
SRV_PROC    *spp;
CS_INT           cmd;
CS_INT          type;

Parameters

spp

A pointer to an internal thread control structure.

cmd

Indicates whether the application is calling srv_negotiate to send or retrieve negotiated login information. Table 3-67 describes the legal values for cmd:

Table 3-67: Values for cmd (srv_negotiate)

Value

Description

CS_SET

The negotiated login information defined by type is to be sent to the client.

CS_GET

The negotiated login information defined by type is to be read from the client.

type

The type of negotiated login information to be sent to or read from a client. Table 3-68 describes the legal values for type:

Table 3-68: Values for type (srv_negotiate)

Value

Description

SRV_NEG_CHALLENGE

The negotiated login information is a challenge byte stream sent to the client (CS_SET) or a challenge response byte stream read from the client (CS_GET).

SRV_NEG_ENCRYPT

The negotiated login information consists of an encryption key sent to the client. The client will then use this to encrypt its local and remote passwords. This type is only valid when cmd is CS_SET.

SRV_NEG_EXTENDED_ENCRYPT

The negotiated login information and public key used to encrypt the password.These information are used by the client. This type is only valid when cmd is CS_SET.

SRV_NEG_EXTENDED_LOCPWD

The public key encrypted password sent by the client in response to a SRV_NEG_EXTENDED_ENCRYPT challenge. This type is only valid when cmd is CS_GET.

SRV_NEG_EXTENDED_REMPWD

The negotiated login information is a variable number of pairs of remote server names and corresponding public key encrypted password sent by the client in response to a SRV_NEG_EXTENDED_ENCRYPT challenge. This type is only valid when cmd is CS_GET.

SRV_NEG_LOCPWD

The encrypted local password sent by the client in response to a SRV_NEG_ENCRYPT challenge. This type is only valid when cmd is CS_GET.

SRV_NEG_REMPWD

The negotiated login information is a variable number of remote server name and encrypted remote password pairs sent by the client in response to a SRV_NEG_ENCRYPT challenge. This type is only valid when cmd is CS_GET.

SRV_NEG_SECLABEL

The negotiated login information is a request for security labels sent to the client, or a set of security labels sent by the client to the server.

SRV_NEG_SECSESSION

The negotiated login information is used by a full passthrough gateway application to establish a direct security session between a gateway client and a remote server. This is similar to challenge-response security negotiation. Refer to “Security services” for more information and for an example security session callback.

An integer value between CS_USER_MSGID and CS_USER_MAX_MSGID, inclusive.

The negotiated login information is part of an application-defined handshake, identified by the type argument itself.

Returns

Table 3-69: Return values (srv_negotiate)

Returns

To indicate

CS_SUCCEED

The routine completed successfully.

CS_FAIL

The routine failed.

Examples

Example 1

#include  <ospublic.h>

/*
** Local Prototype.
*/
CS_RETCODE    ex_srv_negotiate PROTOTYPE((
SRV_PROC      *sproc
));

/*
** EX_SRV_NEGOTIATE
**  An example routine to retrieve negotiated login information
 **  by using srv_negotiate.
**
** Arguments:
**  sproc  A pointer to an internal thread control structure.
**
** Returns:
**  CS_SUCCEED   The login information was retrieved.
**  CS_FAIL      An error was detected.
*/
CS_RETCODE   ex_srv_negotiate(sproc)
SRV_PROC     *sproc;
{
    /* 
    ** Check to make sure that the thread control structure is
     ** not NULL.
    */
    if ( sproc == (SRV_PROC *)NULL )
    {
        return(CS_FAIL);
    }

    /* Now get the login information. */
    if ( srv_negotiate(sproc, CS_GET, SRV_NEG_CHALLENGE) ==          CS_FAIL )
    {
        return(CS_FAIL);
    }

    return(CS_SUCCEED);
}

Usage

See also

srv_senddone, srv_thread_props