Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Notification callbacks [Table of Contents] Server message callbacks

Open Client Client-Library/C Reference Manual

[-] Chapter 2 Topics
[-] Callbacks
[-] Security session callbacks

Security session callbacks

An Open Server gateway needs a security session callback only if all of the following statements are true:

If not all of the above conditions apply, Client-Library provides a default callback that is adequate.

See "Requesting login authentication services".

Establishing a direct security session

A security session is a client/server connection where the client and the server have agreed to use an external security mechanism (such as DCE) and a set of security services (such as data encryption).

In a gateway application, a direct security session is established between a gateway's client and a remote server. The gateway acts as an intermediary while the session is established, but afterwards, the gateway is not part of the security session. Direct security sessions are useful in the following circumstances:

A security session callback allows the gateway to set up a direct security session. When the connection to the remote server is made, the callback routine acts as an intermediary for the handshaking required between the remote server and the gateway's client. The handshaking process is outlined below:

  1. When the gateway calls ct_connect, the remote server issues one or more security session messages.

  2. For each security session message sent by the remote server, Client-Library invokes the callback, passing the security session information sent by the remote server as the callback's input parameters.

  3. The callback forwards the information to the gateway's client by calling the Server-Library routine srv_negotiate(CS_SET, SRV_NEG_SECSESSION).

  4. The callback then reads the client's response and returns it to Client-Library via the callback's output parameters.

  5. Client-Library forwards the response to the remote server.

If the remote server sends another security session message, the process is repeated.

Defining a security session callback

A security session callback is defined as follows:

CS_RETCODE CS_PUBLIC 
 secsession_cb (conn, 
               numinputs, infmt, inbuf, 
               numoutputs, outfmt, outbuf, outlen)
 CS_CONNECTION    *conn;
 CS_INT                       numinputs;
 CS_DATAFMT            *infmt;
 CS_BYTE                   **inbuf;
 CS_INT                       *numoutputs;
 CS_DATAFMT             *outfmt;
 CS_BYTE                    **outbuf;
 CS_INT                        *outlen;

where:

The callback forwards the security session message data and reads the client's response with Server-Library calls. See the reference page for srv_negotiate in the Open Server Server-Library/C Reference Manual.

A security session callback returns CS_SUCCEED or CS_FAIL. If the callback returns CS_FAIL, Client-Library aborts the connection attempt. Other return values are illegal: Client-Library responds by raising an error and aborting the connection attempt.


Notification callbacks [Table of Contents] Server message callbacks