From fc135d64a1ad6b36d807e6b7ab9d804bffe95e48 Mon Sep 17 00:00:00 2001 From: ultramage Date: Tue, 25 Mar 2008 09:56:18 +0000 Subject: Added proper checks to adoption processing (followup to r12428). Cleaned up some code / fixed some typos. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12432 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/login_sql/login.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/login_sql') diff --git a/src/login_sql/login.c b/src/login_sql/login.c index f4a40c990..fddb4b248 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -553,17 +553,22 @@ int mmo_auth(struct mmo_account* account, int fd) if( login_config.online_check ) { struct online_login_data* data = idb_get(online_db, account->account_id); - if( data && data->char_server > -1 ) - { - //Request char servers to kick this account out. [Skotlex] - uint8 buf[8]; - ShowNotice("User '%s' is already online - Rejected.\n", account->userid); - WBUFW(buf,0) = 0x2734; - WBUFL(buf,2) = account->account_id; - charif_sendallwos(-1, buf, 6); - if( data->waiting_disconnect == -1 ) - data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, account->account_id, 0); - return 3; // Rejected + if( data ) + {// account is already marked as online! + if( data->char_server > -1 ) + {// Request char servers to kick this account out. [Skotlex] + uint8 buf[8]; + ShowNotice("User '%s' is already online - Rejected.\n", account->userid); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = account->account_id; + charif_sendallwos(-1, buf, 6); + if( data->waiting_disconnect == -1 ) + data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, account->account_id, 0); + return 3; // Rejected + } + else + ; // the client disconnects after doing auth, so can't really kick it... need some form of expiration timer + } } @@ -667,7 +672,7 @@ int parse_fromchar(int fd) auth_fifo[i].login_id2 == login_id2 && auth_fifo[i].sex == sex && auth_fifo[i].ip == ip_ && - !auth_fifo[i].delflag ); + auth_fifo[i].delflag == 0 ); if( i == AUTH_FIFO_SIZE || account_id <= 0 ) {// authentication not found -- cgit v1.2.3-60-g2f50