~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_file/auth_file.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 05:18:30 UTC
  • mto: This revision was merged to the branch mainline in revision 2009.
  • Revision ID: brian@tangent.org-20101218051830-lswb13hfiqbia74o
Adding user identifier that makes use of a shared ptr to handle concurrency
issues around looking at the state of a connection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include "drizzled/configmake.h"
31
31
#include "drizzled/plugin/authentication.h"
32
 
#include "drizzled/security_context.h"
 
32
#include "drizzled/identifier.h"
33
33
#include "drizzled/util/convert.h"
34
34
#include "drizzled/algorithm/sha1.h"
35
35
#include "drizzled/module/option_map.h"
71
71
  /**
72
72
   * Base class method to check authentication for a user.
73
73
   */
74
 
  bool authenticate(const SecurityContext &sctx, const string &password);
 
74
  bool authenticate(const identifier::User &sctx, const string &password);
75
75
 
76
76
  /**
77
77
   * Verify the local and remote scrambled password match using the MySQL
202
202
  return memcmp(local_scrambled_password, scrambled_password_check, SHA1_DIGEST_LENGTH) == 0;
203
203
}
204
204
 
205
 
bool AuthFile::authenticate(const SecurityContext &sctx, const string &password)
 
205
bool AuthFile::authenticate(const identifier::User &sctx, const string &password)
206
206
{
207
 
  std::map<std::string, std::string>::const_iterator user= users.find(sctx.getUser());
 
207
  std::map<std::string, std::string>::const_iterator user= users.find(sctx.username());
208
208
  if (user == users.end())
209
209
    return false;
210
210
 
211
 
  if (sctx.getPasswordType() == SecurityContext::MYSQL_HASH)
 
211
  if (sctx.getPasswordType() == identifier::User::MYSQL_HASH)
212
212
    return verifyMySQLHash(user->second, sctx.getPasswordContext(), password);
213
213
 
214
214
  if (password == user->second)