diff options
-rw-r--r-- | src/char_sql/char.c | 4 | ||||
-rw-r--r-- | src/char_sql/int_storage.c | 2 | ||||
-rw-r--r-- | src/login/login.c | 81 |
3 files changed, 45 insertions, 42 deletions
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index e2baa3b9e..e13744754 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -3930,7 +3930,11 @@ int do_init(int argc, char **argv) Sql_ShowDebug(sql_handle); ShowInfo("End of char server initilization function.\n"); + + ShowInfo("open port %d.....\n",char_port); + char_fd = make_listen_bind(bind_ip, char_port); ShowStatus("The char-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", char_port); + return 0; } diff --git a/src/char_sql/int_storage.c b/src/char_sql/int_storage.c index b13f37200..fc8d9f8f3 100644 --- a/src/char_sql/int_storage.c +++ b/src/char_sql/int_storage.c @@ -24,7 +24,7 @@ struct guild_storage *guild_storage_pt=NULL; #endif //TXT_SQL_CONVERT /// Save guild_storage data to sql -int storage_tosql(int account_id,struct storage* p) +int storage_tosql(int account_id, struct storage* p) { memitemdata_to_sql(p->storage_, MAX_STORAGE, account_id, TABLE_STORAGE); //ShowInfo ("storage save to DB - account: %d\n", account_id); diff --git a/src/login/login.c b/src/login/login.c index a1d8cd758..61d9bbf1f 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -1241,54 +1241,53 @@ int mmo_auth(struct mmo_account* account, int fd) return 0; // 0 = Unregistered ID } - if( login_config.use_md5_passwds ) - MD5_String(account->passwd, user_password); - else - safestrncpy(user_password, account->passwd, NAME_LENGTH); + if( login_config.use_md5_passwds ) + MD5_String(account->passwd, user_password); + else + safestrncpy(user_password, account->passwd, NAME_LENGTH); - if( !check_password(session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) ) - { - login_log("Invalid password (account: %s, pass: %s, received pass: %s, ip: %s)\n", account->userid, auth_dat[i].pass, (account->passwdenc) ? "[MD5]" : account->passwd, ip); - return 1; // 1 = Incorrect Password - } + if( !check_password(session[fd]->session_data, account->passwdenc, user_password, auth_dat[i].pass) ) + { + login_log("Invalid password (account: %s, pass: %s, received pass: %s, ip: %s)\n", account->userid, auth_dat[i].pass, (account->passwdenc) ? "[MD5]" : account->passwd, ip); + return 1; // 1 = Incorrect Password + } - if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) ) - { - login_log("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", account->userid, account->passwd, ip); - return 2; // 2 = This ID is expired - } + if( auth_dat[i].connect_until_time != 0 && auth_dat[i].connect_until_time < time(NULL) ) + { + login_log("Connection refused (account: %s, pass: %s, expired ID, ip: %s)\n", account->userid, account->passwd, ip); + return 2; // 2 = This ID is expired + } - if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) ) - { - strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); - tmpstr[19] = '\0'; - login_log("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", account->userid, account->passwd, tmpstr, ip); - return 6; // 6 = Your are Prohibited to log in until %s - } + if( auth_dat[i].ban_until_time != 0 && auth_dat[i].ban_until_time > time(NULL) ) + { + strftime(tmpstr, 20, login_config.date_format, localtime(&auth_dat[i].ban_until_time)); + tmpstr[19] = '\0'; + login_log("Connection refused (account: %s, pass: %s, banned until %s, ip: %s)\n", account->userid, account->passwd, tmpstr, ip); + return 6; // 6 = Your are Prohibited to log in until %s + } - if( auth_dat[i].state ) - { - login_log("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", account->userid, account->passwd, auth_dat[i].state, ip); - return auth_dat[i].state - 1; - } + if( auth_dat[i].state ) + { + login_log("Connection refused (account: %s, pass: %s, state: %d, ip: %s)\n", account->userid, account->passwd, auth_dat[i].state, ip); + return auth_dat[i].state - 1; + } - if( login_config.online_check ) + if( login_config.online_check ) + { + struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id); + if( data && data->char_server > -1 ) { - struct online_login_data* data = idb_get(online_db,auth_dat[i].account_id); - if( data && data->char_server > -1 ) - { - //Request char servers to kick this account out. [Skotlex] - unsigned char buf[8]; - ShowNotice("User [%d] is already online - Rejected.\n",auth_dat[i].account_id); - WBUFW(buf,0) = 0x2734; - WBUFL(buf,2) = auth_dat[i].account_id; - charif_sendallwos(-1, buf, 6); - if( data->waiting_disconnect == -1 ) - data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0); - return 3; // Rejected - } + //Request char servers to kick this account out. [Skotlex] + unsigned char buf[8]; + ShowNotice("User [%d] is already online - Rejected.\n",auth_dat[i].account_id); + WBUFW(buf,0) = 0x2734; + WBUFL(buf,2) = auth_dat[i].account_id; + charif_sendallwos(-1, buf, 6); + if( data->waiting_disconnect == -1 ) + data->waiting_disconnect = add_timer(gettick()+30000, waiting_disconnect_timer, auth_dat[i].account_id, 0); + return 3; // Rejected } - + } login_log("Authentification accepted (account: %s (id: %d), ip: %s)\n", account->userid, auth_dat[i].account_id, ip); |