Liberator Auth API  7.1.33.251325-ac556235
system.c

This example creates a new system object called /SYSTEM/AUTH/MYAUTH and updates the field "number-users" with the total number of logins, and the field "last-user" with the username of the last user to login.

static object_t *info_object;
static int num_users_fieldnum;
static int last_user_fieldnum;
void auth_mod_init(nodeinfo_t *nodeinfo, authfuncs_t *funcs, eventcallback_t callback)
{
/* Setup authfuncs_t here */
num_users_fieldnum = infoob_add_field("number-users",0);
last_user_fieldnum = infoob_add_field("last-user",0);
info_object = infoob_new_object("MYAUTH");
}
int auth_new_user(session_t *session, char *user, char *pass)
{
static int num_users;
++num_users;
infoob_add_int(info_object,num_users_fieldnum,num_users);
infoob_add_str(info_object,last_user_fieldnum,user);
return AUTH_OK;
}

Generated on Fri May 24 2024 16:30:46 for Liberator Auth API