~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_ldap/auth_ldap.cc

  • Committer: Brian Aker
  • Date: 2010-12-18 10:14:05 UTC
  • mfrom: (2008.1.3 clean)
  • Revision ID: brian@tangent.org-20101218101405-qjbse29shi9coklg
Merge of user identifier work

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include <string>
30
30
 
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
 
99
99
  /**
100
100
   * Base class method to check authentication for a user.
101
101
   */
102
 
  bool authenticate(const SecurityContext &sctx, const string &password);
 
102
  bool authenticate(const identifier::User &sctx, const string &password);
103
103
 
104
104
  /**
105
105
   * Lookup a user in LDAP.
200
200
  return error;
201
201
}
202
202
 
203
 
bool AuthLDAP::authenticate(const SecurityContext &sctx, const string &password)
 
203
bool AuthLDAP::authenticate(const identifier::User &sctx, const string &password)
204
204
{
205
205
  /* See if cache should be emptied. */
206
206
  if (cache_timeout > 0)
222
222
 
223
223
  pthread_rwlock_rdlock(&lock);
224
224
 
225
 
  AuthLDAP::UserCache::const_iterator user= users.find(sctx.getUser());
 
225
  AuthLDAP::UserCache::const_iterator user= users.find(sctx.username());
226
226
  if (user == users.end())
227
227
  {
228
228
    pthread_rwlock_unlock(&lock);
230
230
    pthread_rwlock_wrlock(&lock);
231
231
 
232
232
    /* Make sure the user was not added while we unlocked. */
233
 
    user= users.find(sctx.getUser());
 
233
    user= users.find(sctx.username());
234
234
    if (user == users.end())
235
 
      lookupUser(sctx.getUser());
 
235
      lookupUser(sctx.username());
236
236
 
237
237
    pthread_rwlock_unlock(&lock);
238
238
 
239
239
    pthread_rwlock_rdlock(&lock);
240
240
 
241
241
    /* Get user again because map may have changed while unlocked. */
242
 
    user= users.find(sctx.getUser());
 
242
    user= users.find(sctx.username());
243
243
    if (user == users.end())
244
244
    {
245
245
      pthread_rwlock_unlock(&lock);
253
253
    return false;
254
254
  }
255
255
 
256
 
  if (sctx.getPasswordType() == SecurityContext::MYSQL_HASH)
 
256
  if (sctx.getPasswordType() == identifier::User::MYSQL_HASH)
257
257
  {
258
258
    bool allow= verifyMySQLHash(user->second, sctx.getPasswordContext(), password);
259
259
    pthread_rwlock_unlock(&lock);