summaryrefslogtreecommitdiff
path: root/src/login/login.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-03-09 00:04:28 -0300
committershennetsind <ind@henn.et>2013-03-09 00:04:28 -0300
commitd2d734ce0983fbed72e69f555f57f29de04f30b3 (patch)
treea3332e1eea882a9df5a2253d9a63153a9197851a /src/login/login.c
parentbb0f807d0683fcb2c0e9fdd6a5d1e54686dfc816 (diff)
downloadhercules-d2d734ce0983fbed72e69f555f57f29de04f30b3.tar.gz
hercules-d2d734ce0983fbed72e69f555f57f29de04f30b3.tar.bz2
hercules-d2d734ce0983fbed72e69f555f57f29de04f30b3.tar.xz
hercules-d2d734ce0983fbed72e69f555f57f29de04f30b3.zip
Hercules Renewal'd Pin Code
Feature is not, I repeat, NOT complete. the decryption is not fully functional which leads to dial values different from the ones the player used. Credits: lemongrass3110 for the base yommy for the packets LightFighter for the decrypt function (altho its not stable :P) Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/login/login.c')
-rw-r--r--src/login/login.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/src/login/login.c b/src/login/login.c
index e174672cc..c16cce342 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -559,6 +559,7 @@ int parse_fromchar(int fd)
int group_id = 0;
uint8 char_slots = 0;
char birthdate[10+1] = "";
+ char pincode[4+1] = "\0\0\0\0\0";
int account_id = RFIFOL(fd,2);
RFIFOSKIP(fd,6);
@@ -570,10 +571,13 @@ int parse_fromchar(int fd)
expiration_time = acc.expiration_time;
group_id = acc.group_id;
char_slots = acc.char_slots;
+ safestrncpy(pincode, acc.pincode, sizeof(pincode));
safestrncpy(birthdate, acc.birthdate, sizeof(birthdate));
+ if( strlen(pincode) == 0 )
+ memset(pincode,'\0',sizeof(pincode));
}
- WFIFOHEAD(fd,63);
+ WFIFOHEAD(fd,72);
WFIFOW(fd,0) = 0x2717;
WFIFOL(fd,2) = account_id;
safestrncpy((char*)WFIFOP(fd,6), email, 40);
@@ -581,7 +585,9 @@ int parse_fromchar(int fd)
WFIFOB(fd,50) = (unsigned char)group_id;
WFIFOB(fd,51) = char_slots;
safestrncpy((char*)WFIFOP(fd,52), birthdate, 10+1);
- WFIFOSET(fd,63);
+ safestrncpy((char*)WFIFOP(fd,63), pincode, 4+1 );
+ WFIFOL(fd,68) = acc.pincode_change;
+ WFIFOSET(fd,72);
}
break;
@@ -907,6 +913,41 @@ int parse_fromchar(int fd)
RFIFOSKIP(fd,2);
break;
+ case 0x2738: //Change PIN Code for a account
+ if( RFIFOREST(fd) < 11 )
+ return 0;
+ else {
+ struct mmo_account acc;
+
+ if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) {
+ strncpy( acc.pincode, (char*)RFIFOP(fd,6), 5 );
+ acc.pincode_change = time( NULL );
+ accounts->save(accounts, &acc);
+ }
+ RFIFOSKIP(fd,11);
+ }
+ break;
+
+ case 0x2739: // PIN Code was entered wrong too often
+ if( RFIFOREST(fd) < 6 )
+ return 0;
+ else {
+ struct mmo_account acc;
+
+ if( accounts->load_num(accounts, &acc, RFIFOL(fd,2) ) ) {
+ struct online_login_data* ld;
+
+ if( ( ld = (struct online_login_data*)idb_get(online_db,acc.account_id) ) == NULL )
+ return 0;
+
+ login_log( host2ip(acc.last_ip), acc.userid, 100, "PIN Code check failed" );
+ }
+
+ remove_online_user(acc.account_id);
+ RFIFOSKIP(fd,6);
+ }
+ break;
+
default:
ShowError("parse_fromchar: Unknown packet 0x%x from a char-server! Disconnecting!\n", command);
set_eof(fd);
@@ -958,6 +999,8 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
safestrncpy(acc.lastlogin, "0000-00-00 00:00:00", sizeof(acc.lastlogin));
safestrncpy(acc.last_ip, last_ip, sizeof(acc.last_ip));
safestrncpy(acc.birthdate, "0000-00-00", sizeof(acc.birthdate));
+ safestrncpy(acc.pincode, "\0", sizeof(acc.pincode));
+ acc.pincode_change = 0;
acc.char_slots = 0;
if( !accounts->create(accounts, &acc) )