diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-09 13:05:54 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-09 13:05:54 +0000 |
commit | 16675230f6fff2b30b48b83e395e273919b5515f (patch) | |
tree | b55bc1f455b99e7dd9635cd06c9aae9c93be1ac2 /src/login/login.c | |
parent | c5c74a00ce7bbc152f20066c22952770535dd7f5 (diff) | |
download | hercules-16675230f6fff2b30b48b83e395e273919b5515f.tar.gz hercules-16675230f6fff2b30b48b83e395e273919b5515f.tar.bz2 hercules-16675230f6fff2b30b48b83e395e273919b5515f.tar.xz hercules-16675230f6fff2b30b48b83e395e273919b5515f.zip |
Fixed login printing raw passwdenc passwords to console (bugreport:826).
Added strlib function bin2hex().
Cleaned up the md5calc interface a bit.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13055 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login/login.c')
-rw-r--r-- | src/login/login.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/login/login.c b/src/login/login.c index 9bcc5ba79..d458a8b88 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -230,12 +230,12 @@ static int sync_ip_addresses(int tid, unsigned int tick, int id, intptr data) //----------------------------------------------------- bool check_encrypted(const char* str1, const char* str2, const char* passwd) { - char md5str[64], md5bin[32]; + char tmpstr[64+1], md5str[32+1]; - safesnprintf(md5str, sizeof(md5str), "%s%s", str1, str2); - MD5_String2binary(md5str, md5bin); + safesnprintf(tmpstr, sizeof(tmpstr), "%s%s", str1, str2); + MD5_String(tmpstr, md5str); - return (0==memcmp(passwd, md5bin, 16)); + return (0==strcmp(passwd, md5str)); } bool check_password(const char* md5key, int passwdenc, const char* passwd, const char* refpass) @@ -1316,8 +1316,8 @@ int parse_login(int fd) } else { - ShowStatus("Request for connection (encryption mode) of %s (ip: %s).\n", sd->userid, ip); - memcpy(sd->passwd, passwd, 16); sd->passwd[16] = '\0'; // raw binary data here! + ShowStatus("Request for connection (passwdenc mode) of %s (ip: %s).\n", sd->userid, ip); + bin2hex(sd->passwd, (unsigned char*)passwd, 16); // raw binary data here! sd->passwdenc = PASSWORDENC; } |