Move loading of user data to authenticator modules
The authenticator modules now load the user data when the new loadusers entry point is called. This new entry point is optional. At the moment the code that was in service.c was just moved into the modules but the ground work for allowing different user loading mechanisms is done. Further improvements need to be made so that the authenticators behave more like routers and filters. This work includes the creation of a AUTHENTICATOR module object, addition of createInstance entry points for authenticators and implementing it for all authenticators.
This commit is contained in:
@ -71,17 +71,11 @@ users_alloc()
|
||||
void
|
||||
users_free(USERS *users)
|
||||
{
|
||||
if (users == NULL)
|
||||
{
|
||||
MXS_ERROR("[%s:%d]: NULL parameter.", __FUNCTION__, __LINE__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (users->data)
|
||||
if (users)
|
||||
{
|
||||
hashtable_free(users->data);
|
||||
MXS_FREE(users);
|
||||
}
|
||||
MXS_FREE(users);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -217,3 +211,18 @@ dcb_usersPrint(DCB *dcb, USERS *users)
|
||||
}
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Default user loading function
|
||||
*
|
||||
* A generic key-value user table is allocated for the service.
|
||||
*
|
||||
* @param port Listener configuration
|
||||
* @return Always AUTH_LOADUSERS_OK
|
||||
*/
|
||||
int users_default_loadusers(SERV_LISTENER *port)
|
||||
{
|
||||
users_free(port->users);
|
||||
port->users = users_alloc();
|
||||
return AUTH_LOADUSERS_OK;
|
||||
}
|
||||
|
Reference in New Issue
Block a user