~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/auth_test/auth_test.cc

  • Committer: kalebral at gmail
  • Date: 2010-12-04 04:58:08 UTC
  • mto: (1971.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1972.
  • Revision ID: kalebral@gmail.com-20101204045808-acto22oxfg43m02e
a few more updates of files that did not have license or had incorrect license structure

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <string>
23
23
 
24
24
#include "drizzled/plugin/authentication.h"
25
 
#include "drizzled/identifier.h"
 
25
#include "drizzled/security_context.h"
26
26
#include "drizzled/util/convert.h"
27
27
#include "drizzled/algorithm/sha1.h"
28
28
 
42
42
    plugin::Authentication(name_arg)
43
43
  { }
44
44
 
45
 
  virtual bool authenticate(const identifier::User &sctx, const string &password)
 
45
  virtual bool authenticate(const SecurityContext &sctx, const string &password)
46
46
  {
47
47
    /* The "root" user always succeeds for drizzletest to get in. */
48
 
    if (sctx.username() == "root" && password.empty())
 
48
    if (sctx.getUser() == "root" && password.empty())
49
49
      return true;
50
50
 
51
51
    /* Any password succeeds. */
52
 
    if (sctx.username() == "password_ok" && !password.empty())
 
52
    if (sctx.getUser() == "password_ok" && !password.empty())
53
53
      return true;
54
54
 
55
55
    /* No password succeeds. */
56
 
    if (sctx.username() == "no_password_ok" && password.empty())
 
56
    if (sctx.getUser() == "no_password_ok" && password.empty())
57
57
      return true;
58
58
 
59
59
    /* Check if MySQL password scramble succeeds. */
60
 
    if (sctx.username() == "scramble_ok" &&
61
 
        sctx.getPasswordType() == identifier::User::MYSQL_HASH &&
 
60
    if (sctx.getUser() == "scramble_ok" &&
 
61
        sctx.getPasswordType() == SecurityContext::MYSQL_HASH &&
62
62
        sctx.getPasswordContext().size() == SHA1_DIGEST_LENGTH &&
63
63
        password.size() == SHA1_DIGEST_LENGTH)
64
64
    {