diff options
author | Davi Arnaut <davi.arnaut@oracle.com> | 2011-05-30 08:14:38 -0300 |
---|---|---|
committer | Davi Arnaut <davi.arnaut@oracle.com> | 2011-05-30 08:14:38 -0300 |
commit | 9f6ec599802bdb36b97780f1a7cf8c6e1293c453 (patch) | |
tree | 616bc92f691605ad3a9a16abeab4fc3ff26ddcff /sql/password.c | |
parent | f3e114291c4f02fccbd01623fd6d415328b657de (diff) | |
parent | 9b68760fd61869626808bf47ac75a9024ea662b7 (diff) | |
download | mariadb-git-9f6ec599802bdb36b97780f1a7cf8c6e1293c453.tar.gz |
Merge of mysql-5.1 into mysql-5.5.
Diffstat (limited to 'sql/password.c')
-rw-r--r-- | sql/password.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/sql/password.c b/sql/password.c index 3b69705cc87..236e7bde0d5 100644 --- a/sql/password.c +++ b/sql/password.c @@ -205,21 +205,16 @@ void scramble_323(char *to, const char *message, const char *password) } -/* - Check scrambled message - Used in pre 4.1 password handling - SYNOPSIS - check_scramble_323() - scrambled scrambled message to check. - message original random message which was used for scrambling; must - be exactly SCRAMBLED_LENGTH_323 bytes long and - NULL-terminated. - hash_pass password which should be used for scrambling - All params are IN. +/** + Check scrambled message. Used in pre 4.1 password handling. - RETURN VALUE - 0 - password correct - !0 - password invalid + @param scrambled Scrambled message to check. + @param message Original random message which was used for scrambling. + @param hash_pass Password which should be used for scrambling. + + @remark scrambled and message must be SCRAMBLED_LENGTH_323 bytes long. + + @return FALSE if password is correct, TRUE otherwise. */ my_bool @@ -228,9 +223,16 @@ check_scramble_323(const unsigned char *scrambled, const char *message, { struct rand_struct rand_st; ulong hash_message[2]; - uchar buff[16],*to,extra; /* Big enough for check */ + /* Big enough for checks. */ + uchar buff[16], scrambled_buff[SCRAMBLE_LENGTH_323 + 1]; + uchar *to, extra; const uchar *pos; + /* Ensure that the scrambled message is null-terminated. */ + memcpy(scrambled_buff, scrambled, SCRAMBLE_LENGTH_323); + scrambled_buff[SCRAMBLE_LENGTH_323]= '\0'; + scrambled= scrambled_buff; + hash_password(hash_message, message, SCRAMBLE_LENGTH_323); randominit(&rand_st,hash_pass[0] ^ hash_message[0], hash_pass[1] ^ hash_message[1]); |