1
#include <drizzled/authentication.h>
3
static bool are_plugins_loaded= false;
5
static bool authenticate_by(THD *thd, plugin_ref plugin, void* p_data)
7
const char *password= (const char *)p_data;
8
authentication_st *auth= plugin_data(plugin, authentication_st *);
12
if (auth && auth->authenticate)
14
if (auth->authenticate(thd, password))
21
bool authenticate_user(THD *thd, const char *password)
23
/* If we never loaded any auth plugins, just return true */
24
if (are_plugins_loaded != true)
27
printf("PASSWORD :%s:\n", password);
29
return plugin_foreach(thd, authenticate_by, MYSQL_AUTH_PLUGIN, (void *)password);
33
int authentication_initializer(st_plugin_int *plugin)
35
authentication_st *authen;
37
if ((authen= (authentication_st *)malloc(sizeof(authentication_st))) == 0)
40
memset(authen, 0, sizeof(authentication_st));
42
if (plugin->plugin->init)
44
if (plugin->plugin->init(authen))
46
sql_print_error("Plugin '%s' init function returned error.",
52
plugin->data= (void *)authen;
53
are_plugins_loaded= true;
61
int authentication_finalizer(st_plugin_int *plugin)
63
authentication_st *authen= (authentication_st *)plugin->data;
66
if (authen && plugin->plugin->deinit)
67
plugin->plugin->deinit(authen);