From fad3040499293b1ff4ff634680163fcab4ca5e70 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 11 Oct 2013 14:07:15 -0300 Subject: Fixed login packet 0x825 Special Thanks to Haru, Yommy. Signed-off-by: shennetsind --- src/login/login.c | 15 +++++++-------- src/login/login.h | 3 ++- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') 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; -- cgit v1.2.3-70-g09d2 From ca15680b184ae630ee90eaa4f71faab19f8fe20e Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 11 Oct 2013 15:20:09 -0300 Subject: Fixed Char Deletion Bug on 2013++ Clients Thanks to LuLu who pointed us in the right direction, http://hercules.ws/board/topic/2453-help-open-pull-request-fixing-char-deletion-time-in-2013-client/ Signed-off-by: shennetsind --- src/char/char.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index 5a51130de..bbf561651 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1897,7 +1897,7 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { offset += MAP_NAME_LENGTH_EXT; #endif #if PACKETVER >= 20100803 - WBUFL(buf,124) = TOL(p->delete_date); + WBUFL(buf,124) = p->delete_date; offset += 4; #endif #if PACKETVER >= 20110111 @@ -3565,7 +3565,12 @@ void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) WFIFOW(fd,0) = 0x828; WFIFOL(fd,2) = char_id; WFIFOL(fd,6) = result; - WFIFOL(fd,10) = TOL(delete_date); +#if PACKETVER >= 20130000 + WFIFOL(fd,10) = delete_date - time(NULL); +#else + WFIFOL(fd,10) = delete_date; + +#endif WFIFOSET(fd,14); } -- cgit v1.2.3-70-g09d2 From cda114b13c65df0249c4c5b365c6860a1c7831ee Mon Sep 17 00:00:00 2001 From: shennetsind Date: Fri, 11 Oct 2013 20:41:41 -0300 Subject: Fixed char.c msvc compiler warnings Thanks to LuLu for bringing it up. Signed-off-by: shennetsind --- src/char/char.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/char/char.c b/src/char/char.c index bbf561651..574e4f66b 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1897,7 +1897,7 @@ int mmo_char_tobuf(uint8* buffer, struct mmo_charstatus* p) { offset += MAP_NAME_LENGTH_EXT; #endif #if PACKETVER >= 20100803 - WBUFL(buf,124) = p->delete_date; + WBUFL(buf,124) = (int)p->delete_date; offset += 4; #endif #if PACKETVER >= 20110111 @@ -3566,9 +3566,9 @@ void char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_date) WFIFOL(fd,2) = char_id; WFIFOL(fd,6) = result; #if PACKETVER >= 20130000 - WFIFOL(fd,10) = delete_date - time(NULL); + WFIFOL(fd,10) = (int)(delete_date - time(NULL)); #else - WFIFOL(fd,10) = delete_date; + WFIFOL(fd,10) = (int)delete_date; #endif WFIFOSET(fd,14); -- cgit v1.2.3-70-g09d2 From 0ca3552670428c4ebe59102a2c3fba2d775006b4 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sat, 12 Oct 2013 00:23:24 -0300 Subject: Fixed Bug #7758 http://hercules.ws/board/tracker/issue-7758-latest-version-map-crash/ Signed-off-by: shennetsind --- src/map/chrif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/chrif.c b/src/map/chrif.c index 01af69fbf..5308eada9 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -1738,7 +1738,7 @@ void chrif_defaults(void) { chrif->update_ip = chrif_update_ip; chrif->disconnectplayer = chrif_disconnectplayer; chrif->removemap = chrif_removemap; - chrif->updatefamelist_ack = chrif->updatefamelist_ack; + chrif->updatefamelist_ack = chrif_updatefamelist_ack; chrif->keepalive = chrif_keepalive; chrif->keepalive_ack = chrif_keepalive_ack; chrif->deadopt = chrif_deadopt; -- cgit v1.2.3-70-g09d2