Bläddra i källkod

* 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://svn.code.sf.net/p/rathena/svn/trunk@14476 54d463be-8e91-2dee-dedb-b68131a5f0ec

ai4rei 14 år sedan
förälder
incheckning
4776f57e86
3 ändrade filer med 14 tillägg och 7 borttagningar
  1. 3 0
      Changelog-Trunk.txt
  2. 10 6
      src/login/login.c
  3. 1 1
      src/login/login.h

+ 3 - 0
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).

+ 10 - 6
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 )

+ 1 - 1
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