~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/authentication.cc

  • Committer: Brian Aker
  • Date: 2009-03-20 18:52:05 UTC
  • mfrom: (950.1.1 mordred)
  • Revision ID: brian@tangent.org-20090320185205-g7o6kq17r25b6odf
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
static bool authenticate_by(Session *session, plugin_ref plugin, void* p_data)
29
29
{
30
30
  const char *password= (const char *)p_data;
31
 
  authentication_st *auth= plugin_data(plugin, authentication_st *);
 
31
  Authentication *auth= plugin_data(plugin, Authentication *);
32
32
 
33
33
  (void)p_data;
34
34
 
35
 
  if (auth && auth->authenticate)
 
35
  if (auth)
36
36
  {
37
37
    if (auth->authenticate(session, password))
38
38
      return true;
47
47
  if (are_plugins_loaded != true)
48
48
    return true;
49
49
 
50
 
  return plugin_foreach(session, authenticate_by, DRIZZLE_AUTH_PLUGIN, (void *)password);
 
50
  return plugin_foreach(session, authenticate_by,
 
51
                        DRIZZLE_AUTH_PLUGIN, (void *)password);
51
52
}
52
53
 
53
54
 
54
55
int authentication_initializer(st_plugin_int *plugin)
55
56
{
56
 
  authentication_st *authen;
57
 
 
58
 
  authen= new authentication_st;
59
 
 
60
 
  if (authen == NULL)
61
 
    return 1;
62
 
 
63
 
  memset(authen, 0, sizeof(authentication_st));
 
57
  Authentication *authen;
 
58
 
64
59
 
65
60
  if (plugin->plugin->init)
66
61
  {
67
 
    if (plugin->plugin->init(authen))
 
62
    if (plugin->plugin->init(&authen))
68
63
    {
69
 
      errmsg_printf(ERRMSG_LVL_ERROR, _("Plugin '%s' init function returned error."),
70
 
                      plugin->name.str);
 
64
      errmsg_printf(ERRMSG_LVL_ERROR,
 
65
                    _("Plugin '%s' init function returned error."),
 
66
                    plugin->name.str);
71
67
      goto err;
72
68
    }
73
69
  }
74
70
 
75
 
  plugin->data= (void *)authen;
 
71
  if (authen == NULL)
 
72
    return 1;
 
73
 
 
74
  plugin->data= static_cast<void *>(authen);
76
75
  are_plugins_loaded= true;
77
76
 
78
77
  plugin->state= PLUGIN_IS_READY;
85
84
 
86
85
int authentication_finalizer(st_plugin_int *plugin)
87
86
{
88
 
  authentication_st *authen= (authentication_st *)plugin->data;
 
87
  Authentication *authen= static_cast<Authentication *>(plugin->data);
89
88
 
90
89
  assert(authen);
91
90
  if (authen && plugin->plugin->deinit)
92
91
    plugin->plugin->deinit(authen);
93
92
 
94
 
  delete authen;
95
 
 
96
93
  return(0);
97
94
}