summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDastgir Pojee <dastgirpojee@rocketmail.com>2013-10-12 10:49:23 +0530
committerDastgir Pojee <dastgirpojee@rocketmail.com>2013-10-12 10:49:23 +0530
commit97979fe1e577aebe77e978c248a08b33b2c0c1a2 (patch)
treea1cc274fea52f11783e73039fab5eda3bae98b36 /src
parentc87513dacd51726390fc28b4d96f385f89c872ac (diff)
parent0ca3552670428c4ebe59102a2c3fba2d775006b4 (diff)
downloadhercules-97979fe1e577aebe77e978c248a08b33b2c0c1a2.tar.gz
hercules-97979fe1e577aebe77e978c248a08b33b2c0c1a2.tar.bz2
hercules-97979fe1e577aebe77e978c248a08b33b2c0c1a2.tar.xz
hercules-97979fe1e577aebe77e978c248a08b33b2c0c1a2.zip
Merge branch 'master' of https://github.com/dastgirpojee/Hercules into SkidConst
Diffstat (limited to 'src')
-rw-r--r--src/char/char.c9
-rw-r--r--src/login/login.c15
-rw-r--r--src/login/login.h3
-rw-r--r--src/map/chrif.c2
4 files changed, 17 insertions, 12 deletions
diff --git a/src/char/char.c b/src/char/char.c
index 5a51130de..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) = TOL(p->delete_date);
+ WBUFL(buf,124) = (int)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) = (int)(delete_date - time(NULL));
+#else
+ WFIFOL(fd,10) = (int)delete_date;
+
+#endif
WFIFOSET(fd,14);
}
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;
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;