~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_ldap/auth_ldap.cc

  • Committer: Mark Atwood
  • Date: 2011-11-14 07:30:41 UTC
  • Revision ID: me@mark.atwood.name-20111114073041-mo2hgg8ouseo2kpu
releaseĀ 2011.11.29

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
{
45
45
 
46
46
std::string uri;
47
 
const std::string DEFAULT_URI= "ldap://localhost/";
 
47
const std::string DEFAULT_URI= "ldap://127.0.0.1/";
48
48
std::string bind_dn;
49
49
std::string bind_password;
50
50
std::string base_dn;
51
51
std::string password_attribute;
52
52
std::string DEFAULT_PASSWORD_ATTRIBUTE= "userPassword";
53
53
std::string mysql_password_attribute;
54
 
const std::string DEFAULT_MYSQL_PASSWORD_ATTRIBUTE= "drizzleMysqlUserPassword";
 
54
const std::string DEFAULT_MYSQL_PASSWORD_ATTRIBUTE= "mysqlUserPassword";
55
55
static const int DEFAULT_CACHE_TIMEOUT= 600;
56
56
typedef constrained_check<int, DEFAULT_CACHE_TIMEOUT, 0, 2147483647> cachetimeout_constraint;
57
57
static cachetimeout_constraint cache_timeout= 0;
272
272
 
273
273
void AuthLDAP::lookupUser(const string& user)
274
274
{
275
 
  string filter("(uid=" + user + ")");
 
275
  string filter("(cn=" + user + ")");
276
276
  const char *attributes[3]=
277
277
  {
278
278
    (char *)password_attribute.c_str(),
421
421
 
422
422
  context.registerVariable(new sys_var_const_string_val("uri", uri));
423
423
  context.registerVariable(new sys_var_const_string_val("bind-dn", bind_dn));
424
 
  //context.registerVariable(new sys_var_const_string_val("bind-password", bind_password));
 
424
  context.registerVariable(new sys_var_const_string_val("bind-password", bind_password));
425
425
  context.registerVariable(new sys_var_const_string_val("base-dn", base_dn));
426
426
  context.registerVariable(new sys_var_const_string_val("password-attribute",password_attribute));
427
427
  context.registerVariable(new sys_var_const_string_val("mysql-password-attribute", mysql_password_attribute));
435
435
{
436
436
  context("uri", po::value<string>(&uri)->default_value(DEFAULT_URI),
437
437
          N_("URI of the LDAP server to contact"));
438
 
  context("bind-dn", po::value<string>(&bind_dn)->default_value(""),
 
438
  context("bind-db", po::value<string>(&bind_dn)->default_value(""),
439
439
          N_("DN to use when binding to the LDAP server"));
440
440
  context("bind-password", po::value<string>(&bind_password)->default_value(""),
441
441
          N_("Password to use when binding the DN"));
451
451
 
452
452
} /* namespace auth_ldap */
453
453
 
454
 
DRIZZLE_DECLARE_PLUGIN
455
 
{
456
 
  DRIZZLE_VERSION_ID,
457
 
  "auth_ldap",
458
 
  "0.2",
459
 
  "Eric Day, Henrik Ingo, Edward Konetzko",
460
 
  "LDAP based authenication.",
461
 
  PLUGIN_LICENSE_GPL,
462
 
  auth_ldap::init, /* Plugin Init */
463
 
  NULL,   /* depends */
464
 
  auth_ldap::init_options    /* config options */
465
 
}
466
 
DRIZZLE_DECLARE_PLUGIN_END;
467
 
 
 
454
DRIZZLE_PLUGIN(auth_ldap::init, NULL, auth_ldap::init_options);