Liberator Auth API  7.1.32.168819-ecf4276a
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 Wed Oct 18 2023 17:52:17 for Liberator Auth API