APIs for group retrieval plug-ins

For the group retrieval plug-in module, you need to implement the following APIs:

  • db2secGroupPluginInit
    Note: The db2secGroupPluginInit API takes as input a pointer, *logMessage_fn, to an API with the following prototype:
    SQL_API_RC (SQL_API_FN db2secLogMessage) 
    (
    db2int32 level,
    void    *data,
    db2int32 length
    );

    The db2secLogMessage API allows the plug-in to log messages to the db2diag log files for debugging or informational purposes. This API is provided by the Db2® database system, so you need not implement it.

  • db2secPluginTerm
  • db2secGetGroupsForUser
  • db2secDoesGroupExist
  • db2secFreeGroupListMemory
  • db2secFreeErrormsg
  • The only API that must be resolvable externally is db2secGroupPluginInit. This API will take a void * parameter, which should be cast to the type:
    typedef struct db2secGroupFunctions_1
    {
    db2int32 version;
    db2int32 plugintype;
    SQL_API_RC (SQL_API_FN * db2secGetGroupsForUser) 
    (
    const char *authid,
    db2int32    authidlen,
    const char *userid,
    db2int32    useridlen,
    const char *usernamespace,
    db2int32    usernamespacelen,
    db2int32    usernamespacetype,
    const char *dbname,
    db2int32    dbnamelen,
    const void *token, 
    db2int32    tokentype,
    db2int32    location,
    const char *authpluginname,
    db2int32    authpluginnamelen,
    void      **grouplist, 
    db2int32   *numgroups, 
    char      **errormsg, 
    db2int32   *errormsglen
    );
    
    SQL_API_RC (SQL_API_FN * db2secDoesGroupExist)
    (
    const char *groupname,
    db2int32    groupnamelen,
    char      **errormsg,
    db2int32   *errormsglen
    );     
      
    SQL_API_RC (SQL_API_FN * db2secFreeGroupListMemory)
    (
    void     *ptr,
    char    **errormsg, 
    db2int32 *errormsglen
    );
      
    SQL_API_RC (SQL_API_FN * db2secFreeErrormsg)
    (
    char *msgtobefree
    );
      
    SQL_API_RC (SQL_API_FN * db2secPluginTerm)
    (
    char    **errormsg,
    db2int32 *errormsglen
    );
        
    } db2secGroupFunctions_1;
    The db2secGroupPluginInit API assigns the addresses for the rest of the externally available functions.
    Note: The _1 indicates that this is the structure corresponding to version 1 of the API. Subsequent interface versions will have the extension _2, _3, and so on.