~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/mysql_protocol/mysql_password.cc

  • Committer: Monty Taylor
  • Date: 2010-12-03 19:56:07 UTC
  • mto: (1975.1.1 build)
  • mto: This revision was merged to the branch mainline in revision 1976.
  • Revision ID: mordred@inaugust.com-20101203195607-yw50aynlw04dt5k6
All protocol stuff except for the buffer_length. WTF?

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
using namespace std;
22
22
 
23
 
namespace drizzled
 
23
namespace drizzle_plugin
24
24
{
25
25
 
26
26
const char* MySQLPasswordName = "mysql_password";
44
44
  return (n == 1);
45
45
}
46
46
 
47
 
String *MySQLPassword::val_str(String *str)
 
47
drizzled::String *MySQLPassword::val_str(drizzled::String *str)
48
48
{
49
 
  String argument;
50
 
  String *password= args[0]->val_str(&argument);
51
 
  SHA1_CTX ctx;
 
49
  drizzled::String argument;
 
50
  drizzled::String *password= args[0]->val_str(&argument);
 
51
  drizzled::SHA1_CTX ctx;
52
52
  uint8_t hash_tmp1[SHA1_DIGEST_LENGTH];
53
53
  uint8_t hash_tmp2[SHA1_DIGEST_LENGTH];
54
54
 
55
 
  SHA1Init(&ctx);
56
 
  SHA1Update(&ctx, reinterpret_cast<uint8_t *>(password->ptr()),
57
 
             password->length());
58
 
  SHA1Final(hash_tmp1, &ctx);
 
55
  drizzled::SHA1Init(&ctx);
 
56
  drizzled::SHA1Update(&ctx, reinterpret_cast<uint8_t *>(password->ptr()),
 
57
                       password->length());
 
58
  drizzled::SHA1Final(hash_tmp1, &ctx);
59
59
 
60
 
  SHA1Init(&ctx);
61
 
  SHA1Update(&ctx, hash_tmp1, SHA1_DIGEST_LENGTH);
62
 
  SHA1Final(hash_tmp2, &ctx);
 
60
  drizzled::SHA1Init(&ctx);
 
61
  drizzled::SHA1Update(&ctx, hash_tmp1, SHA1_DIGEST_LENGTH);
 
62
  drizzled::SHA1Final(hash_tmp2, &ctx);
63
63
 
64
64
  str->realloc(SHA1_DIGEST_LENGTH * 2);
65
 
  drizzled_string_to_hex(str->ptr(), reinterpret_cast<const char*>(hash_tmp2),
66
 
                         SHA1_DIGEST_LENGTH);
 
65
  drizzled::drizzled_string_to_hex(str->ptr(),
 
66
                                   reinterpret_cast<const char*>(hash_tmp2),
 
67
                                   SHA1_DIGEST_LENGTH);
67
68
  str->length(SHA1_DIGEST_LENGTH * 2);
68
69
 
69
70
  return str;
70
71
}
71
72
 
72
 
}
 
73
} /* namespace drizzle_plugin */