~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_file/auth_file.cc

  • Committer: Monty Taylor
  • Date: 2010-10-17 13:07:13 UTC
  • mto: This revision was merged to the branch mainline in revision 1870.
  • Revision ID: mordred@inaugust.com-20101017130713-jgigx0dc178aybf1
auth_file

Show diffs side-by-side

added added

removed removed

Lines of Context:
214
214
{
215
215
  const module::option_map &vm= context.getOptions();
216
216
 
217
 
  if (vm.count("users"))
218
 
  {
219
 
    users_file= const_cast<char *>(vm["users"].as<string>().c_str());
220
 
  }
221
 
 
222
 
  AuthFile *auth_file = new AuthFile("auth_file");
 
217
  AuthFile *auth_file = new AuthFile("auth_file", vm["users"].as<string>());
223
218
  if (!auth_file->loadFile())
224
219
  {
225
220
    errmsg_printf(ERRMSG_LVL_ERROR, _("Could not load auth file: %s\n"),
229
224
  }
230
225
 
231
226
  context.add(auth_file);
 
227
  context.registerVariable(new sys_var_const_string_val("users", vm["users"]));
232
228
  return 0;
233
229
}
234
230
 
235
 
static DRIZZLE_SYSVAR_STR(users,
236
 
                          users_file,
237
 
                          PLUGIN_VAR_READONLY,
238
 
                          N_("File to load for usernames and passwords"),
239
 
                          NULL, /* check func */
240
 
                          NULL, /* update func*/
241
 
                          DEFAULT_USERS_FILE /* default */);
242
 
 
243
 
static drizzle_sys_var* sys_variables[]=
244
 
{
245
 
  DRIZZLE_SYSVAR(users),
246
 
  NULL
247
 
};
248
231
 
249
232
static void init_options(drizzled::module::option_context &context)
250
233
{
255
238
 
256
239
} /* namespace auth_file */
257
240
 
258
 
DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables, auth_file::init_options);
 
241
DRIZZLE_PLUGIN(auth_file::init, NULL, auth_file::init_options);