~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_file/auth_file.cc

  • Committer: Vijay Samuel
  • Date: 2010-08-15 15:41:45 UTC
  • mto: (1711.1.16 build)
  • mto: This revision was merged to the branch mainline in revision 1713.
  • Revision ID: vijay@vijay-20100815154145-9uk9wnslwr6vl5l9
Merge precautionary fix for auth_file to prevent plugin from breaking when my_getopt is removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "drizzled/security_context.h"
29
29
#include "drizzled/util/convert.h"
30
30
#include "drizzled/algorithm/sha1.h"
 
31
#include <boost/program_options.hpp>
 
32
#include <drizzled/module/option_map.h>
 
33
#include <iostream>
31
34
 
 
35
namespace po= boost::program_options;
32
36
using namespace std;
33
37
using namespace drizzled;
34
38
 
208
212
 
209
213
static int init(module::Context &context)
210
214
{
 
215
  const module::option_map &vm= context.getOptions();
 
216
 
 
217
  if (vm.count("users"))
 
218
  {
 
219
    users_file= const_cast<char *>(vm["users"].as<string>().c_str());
 
220
  }
 
221
 
211
222
  AuthFile *auth_file = new AuthFile("auth_file");
212
223
  if (!auth_file->loadFile())
213
224
  {
235
246
  NULL
236
247
};
237
248
 
 
249
static void init_options(drizzled::module::option_context &context)
 
250
{
 
251
  context("users", 
 
252
          po::value<string>()->default_value(DEFAULT_USERS_FILE),
 
253
          N_("File to load for usernames and passwords"));
 
254
}
 
255
 
238
256
} /* namespace auth_file */
239
257
 
240
 
DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables, NULL);
 
258
DRIZZLE_PLUGIN(auth_file::init, auth_file::sys_variables, auth_file::init_options);