Previous Topic: For UNIXNext Topic: authxapi_UnregisterExitFunction Function


authxapi_RegisterExitFunction Function

Valid on UNIX

The authxapi_RegisterExitFunction function registers an exit function for a specific event. Registration should be handled during program startup and shutdown, although it can be performed at any stage.

If the function succeeds, it returns 0. If it fails, it sets the global variable errno and returns one of the following error codes:

Return Value

ERRNO

Meaning

AUTHXAPI_E_OCCUPIED

EEXIST

Event already registered.

AUTHXAPI_E_NOEVENT

EINVAL

Invalid event code.

int authxapi_RegisterExitFunction (int event, PFSeosExitFunc user_func);
event

Code of the event to which your Exits API function is registered. Password events are available only when linked to the password utility. General system events are available only when linked to the seosd daemon.

Valid event values are:

AUTHXAPI_EV_PRELOGIN

Pre‑login event

AUTHXAPI_EV_POSTLOGIN

Post‑login event

AUTHXAPI_EV_PREGNRES

Pre‑general resource event

AUTHXAPI_EV_POSTGNRES

Post‑general resource event

AUTHXAPI_EV_PREINET

Pre‑TCP/IP request event

AUTHXAPI_EV_POSTINET

Post‑TCP/IP request event

AUTHXAPI_EV_PREVERPWD

Pre‑password quality check event

AUTHXAPI_EV_POSTVERPWD

Post‑password quality check event

AUTHXAPI_EV_PRESETPWD

Pre‑password change event

AUTHXAPI_EV_POSTSETPWD

Post‑password change event

user_func

Pointer to the user function that CA ControlMinder should call when the specified event occurs.

Example: Registering a User's Exit Function.

This example illustrates how you use the authxapi_RegisterExitFunction function to deny all login attempts for the user ismith.

/* Sample function to deny all login attempts of user 'jsmith' */
int MyExitFunc(void *exit_data, SEOS_EXITRES *res)
{
    SEOS_EXITLOGIN *login_data;

    login_data = (SEOS_EXITLOGIN *)exit_data;
    if (login_data‑>szUname != NULL)
    {
             if (strcmp(login_data‑>szUname, “jsmith”))
                 return 0;
             res‑>result = SEOS_EXITR_DENY;
    }
    return 0;
}

/* The function Access Control looks for on initialization */
/* of extension. */
int sample_RegisterExit(void)
{
    return authxapi_RegisterExitFunction(AUTHXAPI_EV_PRELOGIN,
                                         MyExitFunc);
}

More information:

authxapi_UnregisterExitFunction Function