~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/authentication.cc

  • Committer: Brian Aker
  • Date: 2009-04-13 16:22:40 UTC
  • mfrom: (971.1.78 mordred)
  • Revision ID: brian@gaz-20090413162240-ugi3gvhofmcuglzl
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <drizzled/server_includes.h>
22
 
#include <drizzled/authentication.h>
23
 
#include <drizzled/gettext.h>
24
 
#include <drizzled/errmsg_print.h>
 
21
#include "drizzled/server_includes.h"
 
22
#include "drizzled/authentication.h"
 
23
#include "drizzled/gettext.h"
 
24
#include "drizzled/errmsg_print.h"
 
25
#include "drizzled/plugin_registry.h"
25
26
 
26
27
#include <vector>
27
28
 
31
32
 
32
33
static bool are_plugins_loaded= false;
33
34
 
34
 
static void add_authentication(Authentication *auth)
 
35
void add_authentication(Authentication *auth)
35
36
{
36
37
  all_authentication.push_back(auth);
37
38
}
38
39
 
39
 
static void remove_authentication(Authentication *auth)
 
40
void remove_authentication(Authentication *auth)
40
41
{
41
42
  all_authentication.erase(find(all_authentication.begin(),
42
43
                                all_authentication.end(),
75
76
  return iter != all_authentication.end();
76
77
}
77
78
 
78
 
 
79
 
int authentication_initializer(st_plugin_int *plugin)
80
 
{
81
 
  Authentication *authen= NULL;
82
 
 
83
 
  if (plugin->plugin->init)
84
 
  {
85
 
    if (plugin->plugin->init(&authen))
86
 
    {
87
 
      errmsg_printf(ERRMSG_LVL_ERROR,
88
 
                    _("Plugin '%s' init function returned error."),
89
 
                    plugin->name.str);
90
 
      return 1;
91
 
    }
92
 
  }
93
 
 
94
 
  if (authen == NULL)
95
 
    return 1;
96
 
 
97
 
  add_authentication(authen);
98
 
  plugin->data= authen;
99
 
  are_plugins_loaded= true;
100
 
 
101
 
  return 0;
102
 
}
103
 
 
104
 
int authentication_finalizer(st_plugin_int *plugin)
105
 
{
106
 
  Authentication *authen= static_cast<Authentication *>(plugin->data);
107
 
  assert(authen);
108
 
 
109
 
  remove_authentication(authen);
110
 
 
111
 
  if (authen && plugin->plugin->deinit)
112
 
    plugin->plugin->deinit(authen);
113
 
 
114
 
  return(0);
115
 
}