db2commexitUserIdentity API - User identity

This function is called to provide the identity of the user for the current socket. It is applicable only in communication buffer exit libraries.

This function is called to inform the communication buffer exit library of the user name and session authorized ID used to establish the connection. The function is also called if these parameters change because of a trusted context switch user or SET SESSION AUTHORIZATION. The user name and session authorization ID are not determined until after the database manager authenticates the user. This function is not called until db2commexitRegister and multiple db2commexitSend and db2commexitRecv functions are called during authentication.

API header file

db2commexit.h

API and data structure syntax

SQL_API_RC ( SQL_API_FN * db2commexitUserIdentity )
(
   void                          * pConnectionContext,
   const db2commexitCommInfo_v1  * pCommInfo,
   db2int32                        state,
   db2int32                        usernameLen,
   const char                    * pUserame,
   db2int32                        sessionAuthidLen,
   const char                    * pSessionAuthid,
   db2int64                      * pReservedFlags,
   char                         ** errormsg,
   db2int32                      * errormsglen
);

db2commexitUserIdentity API Parameters

pConnectionContext
Input. A pointer to communication buffer exit library-specific data. This pointer is specific to the inbound connection. This parameter is passed as input to each function call for that connection. The database manager does not access the memory pointed to by this parameter.
pCommInfo
Input. A pointer to a structure that contains information which identifies the database server and protocol-specific information for the incoming connection. Some of the fields in the structure are not setup until multiple buffers are exchanged with the client. The fields are available in later calls to db2commexitRecv and db2commexitSend. This scenario applies specifically to inbound_appl_id, outbound_appl_id, and connection_type.
State
Input. Indicates under which condition the function is called. Possible values are:
  • DB2COMMEXIT_USERIDENT_NEW_CONNECTION - a new connection.
  • DB2COMMEXIT_USERIDENT_TC_SWITCH_USER - a trusted context switch user is issued.
  • DB2COMMEXIT_USERIDENT_SET_SESSION_USER - SET SESSION AUTHORIZATION SQL statement is issued to change the session authorization ID.
usernameLen
Input. The length of pUsername.
pUsername
Input. The user name that is used to establish the connection.
sessionAuthidLen
Input. The length of pSessionAuthid.
pSessionAuthid
Input. The session authorization ID established for this connection.
pReservedFlags
Input/Output. Reserved for future use. The value must be set to 0 on output.
errormsg
Output. A pointer to the address of an ASCII error message string that is allocated by the communication buffer exit library. This error messages string might be returned in this parameter if the function execution is not successful. This memory is not freed by calling db2commexitFreeErrormsg.
errormsglen
Output. A pointer to an integer that indicates the length, in bytes, of the error message string in the errormsg parameter.