Revision: 6480
Description of bug:
Some usernames can't login to mangos-realmd, even if they put correct password.
Example of such username is "kreved"
How to repeat:
1) run mangos-world
2) type "create kreved somepassword somepassword"
3) run mangos-realmd
4) Run client and try to login
Other information:
This bug activates when sha1(username) ends with 0x00
(For example sha1("KREVED") = 901b43e4f42ce49ba47b112ab70f6f554e9c4400)
this 0x00 is lost when "t4.SetBinary(sha.GetDigest(), 20);"
Patch:
Index: src/realmd/AuthSocket.cpp
===================================================================
--- src/realmd/AuthSocket.cpp (revision 6480)
+++ src/realmd/AuthSocket.cpp (working copy)
@@ -622,11 +622,13 @@
sha.Initialize();
sha.UpdateData(_login);
sha.Finalize();
- BigNumber t4;
- t4.SetBinary(sha.GetDigest(), 20);
+ uint8 t4[sHA_DIGEST_LENGTH];
+ memcpy(t4, sha.GetDigest(), SHA_DIGEST_LENGTH);
sha.Initialize();
- sha.UpdateBigNumbers(&t3, &t4, &s, &A, &B, &K, NULL);
+ sha.UpdateBigNumbers(&t3, NULL);
+ sha.UpdateData(t4, SHA_DIGEST_LENGTH);
+ sha.UpdateBigNumbers(&s, &A, &B, &K, NULL);
sha.Finalize();
BigNumber M;
M.SetBinary(sha.GetDigest(), 20);