summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-11 14:07:15 -0300
committershennetsind <ind@henn.et>2013-10-11 14:07:15 -0300
commitfad3040499293b1ff4ff634680163fcab4ca5e70 (patch)
tree65fa32c8395714bc080043a9db537c33d2da9ff8
parent231f7a4f31b27611af7006e3adc2d3c046356fd3 (diff)
downloadhercules-fad3040499293b1ff4ff634680163fcab4ca5e70.tar.gz
hercules-fad3040499293b1ff4ff634680163fcab4ca5e70.tar.bz2
hercules-fad3040499293b1ff4ff634680163fcab4ca5e70.tar.xz
hercules-fad3040499293b1ff4ff634680163fcab4ca5e70.zip
Fixed login packet 0x825
Special Thanks to Haru, Yommy. Signed-off-by: shennetsind <ind@henn.et>
-rw-r--r--src/login/login.c15
-rw-r--r--src/login/login.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/src/login/login.c b/src/login/login.c
index b603117e4..f81ee30c7 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1383,11 +1383,11 @@ int parse_login(int fd)
{
uint32 version;
char username[NAME_LENGTH];
- char password[NAME_LENGTH];
+ char password[PASSWD_LEN];
unsigned char passhash[16];
uint8 clienttype;
bool israwpass = (command==0x0064 || command==0x0277 || command==0x02b0 || command == 0x0825);
-
+
// Shinryo: For the time being, just use token as password.
if(command == 0x0825)
{
@@ -1397,15 +1397,14 @@ int parse_login(int fd)
size_t uTokenLen = RFIFOREST(fd) - 0x5C;
version = RFIFOL(fd,4);
-
- if(uAccLen > NAME_LENGTH - 1 || uAccLen <= 0 || uTokenLen > NAME_LENGTH - 1 || uTokenLen <= 0)
- {
+
+ if(uAccLen <= 0 || uTokenLen <= 0) {
login_auth_failed(sd, 3);
return 0;
}
- safestrncpy(username, accname, uAccLen + 1);
- safestrncpy(password, token, uTokenLen + 1);
+ safestrncpy(username, accname, NAME_LENGTH);
+ safestrncpy(password, token, PASSWD_LEN);
clienttype = RFIFOB(fd, 8);
}
else
@@ -1431,7 +1430,7 @@ int parse_login(int fd)
if( israwpass )
{
ShowStatus("Request for connection of %s (ip: %s).\n", sd->userid, ip);
- safestrncpy(sd->passwd, password, NAME_LENGTH);
+ safestrncpy(sd->passwd, password, PASSWD_LEN);
if( login_config.use_md5_passwds )
MD5_String(sd->passwd, sd->passwd);
sd->passwdenc = 0;
diff --git a/src/login/login.h b/src/login/login.h
index 8a5eabb09..0a41b803f 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -19,6 +19,7 @@ enum E_LOGINSERVER_ST
// supported encryption types: 1- passwordencrypt, 2- passwordencrypt2, 3- both
#define PASSWORDENC 3
+#define PASSWD_LEN 32+1 // 23+1 for plaintext, 32+1 for md5-ed passwords
struct login_session_data {
int account_id;
@@ -27,7 +28,7 @@ struct login_session_data {
char sex;// 'F','M','S'
char userid[NAME_LENGTH];
- char passwd[32+1]; // 23+1 for plaintext, 32+1 for md5-ed passwords
+ char passwd[PASSWD_LEN];
int passwdenc;
char md5key[20];
uint16 md5keylen;