From 5035131dab63fd4667cb3267a5d447866843c334 Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sat, 20 Nov 2010 10:10:11 +0000 Subject: * Fixed login-server account engine initialization not getting checked, whether it succeeds or not (bugreport:4361, since r12700, related r13000). - Failure to retrieve account engine and initializing it is now considered fatal and causes the server to exit immediately. - Fixed two data type inconsistencies, while being at it. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14476 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 3 +++ src/login/login.c | 16 ++++++++++------ src/login/login.h | 2 +- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 597f278fb..01d5bd682 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -2,6 +2,9 @@ Date Added 2010/11/20 * Fixed @doom and @doommap spamming packets for the visual effect on invoker unnecessarily over whole map and server respectively. The effect is now displayed on each killed character (bugreport:871, since r311). [Ai4rei] + * Fixed login-server account engine initialization not getting checked, whether it succeeds or not (bugreport:4361, since r12700, related r13000). [Ai4rei] + - Failure to retrieve account engine and initializing it is now considered fatal and causes the server to exit immediately. + - Fixed two data type inconsistencies, while being at it. 2010/11/19 * Various VC6-related fixes and tweaks. [Ai4rei] - Fixed a typo in VC6 project files, that prevented login-server from compiling (bugreport:4061, since r12727). diff --git a/src/login/login.c b/src/login/login.c index 59a110348..e888d21f6 100644 --- a/src/login/login.c +++ b/src/login/login.c @@ -577,7 +577,7 @@ int parse_fromchar(int fd) struct mmo_account acc; int account_id = RFIFOL(fd,2); - int state = RFIFOL(fd,6); + unsigned int state = RFIFOL(fd,6); RFIFOSKIP(fd,10); if( !accounts->load_num(accounts, &acc, account_id) ) @@ -1543,7 +1543,7 @@ int login_config_read(const char* cfgName) else if(!strcmpi(w1, "check_client_version")) login_config.check_client_version = (bool)config_switch(w2); else if(!strcmpi(w1, "client_version_to_connect")) - login_config.client_version_to_connect = atoi(w2); + login_config.client_version_to_connect = strtoul(w2, NULL, 10); else if(!strcmpi(w1, "use_MD5_passwords")) login_config.use_md5_passwds = (bool)config_switch(w2); else if(!strcmpi(w1, "min_level_to_connect")) @@ -1723,14 +1723,18 @@ int do_init(int argc, char** argv) accounts = get_account_engine(); if( accounts == NULL ) { - ShowError("do_init: account engine '%s' not found.\n", login_config.account_engine); - runflag = 0; - return 1; + ShowFatalError("do_init: account engine '%s' not found.\n", login_config.account_engine); + exit(EXIT_FAILURE); } else { ShowInfo("Using account engine '%s'.\n", login_config.account_engine); - accounts->init(accounts); + + if(!accounts->init(accounts)) + { + ShowFatalError("do_init: Failed to initialize account engine '%s'.\n", login_config.account_engine); + exit(EXIT_FAILURE); + } } if( login_config.console ) diff --git a/src/login/login.h b/src/login/login.h index 2e5af3b5e..807caaed6 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -58,7 +58,7 @@ struct Login_Config { bool use_md5_passwds; // work with password hashes instead of plaintext passwords? int min_level_to_connect; // minimum level of player/GM (0: player, 1-99: GM) to connect bool check_client_version; // check the clientversion set in the clientinfo ? - int client_version_to_connect; // the client version needed to connect (if checking is enabled) + uint32 client_version_to_connect; // the client version needed to connect (if checking is enabled) bool admin_state; // is ladmin support enabled? char admin_pass[24]; // security password for ladmin -- cgit v1.2.3-60-g2f50