Explorar el Código

Added a new login server config for _F/_M account creation method which denies an account creation if either userid or password length is lower than 4 (should be used with conjunction of Disable 4 LetterUserID/Disable 4 LetterPassword client diffs)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15265 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind hace 13 años
padre
commit
292fffeb02
Se han modificado 3 ficheros con 11 adiciones y 1 borrados
  1. 4 0
      conf/login_athena.conf
  2. 6 0
      src/login/login.c
  3. 1 1
      src/login/login.h

+ 4 - 0
conf/login_athena.conf

@@ -43,6 +43,10 @@ console: off
 // Can you use _M/_F to make new accounts on the server?
 new_account: yes
 
+//If new_account is enabled, minimum length to userid and passwords should be 4?
+//Must be 'Yes' unless your client uses both 'Disable 4 LetterUserID/Password' Diffs
+new_acc_length_limit: yes
+
 // Account registration flood protection system
 // allowed_regs is the number of registrations allowed in time_allowed (in seconds)
 allowed_regs: 1

+ 6 - 0
src/login/login.c

@@ -931,6 +931,9 @@ int mmo_auth_new(const char* userid, const char* pass, const char sex, const cha
 		return 3;
 	}
 
+	if( login_config.new_acc_length_limit && ( strlen(userid) < 4 || strlen(pass) < 4 ) )
+		return 1;
+
 	// check for invalid inputs
 	if( sex != 'M' && sex != 'F' )
 		return 0; // 0 = Unregistered ID
@@ -1507,6 +1510,7 @@ void login_set_defaults()
 	safestrncpy(login_config.date_format, "%Y-%m-%d %H:%M:%S", sizeof(login_config.date_format));
 	login_config.console = false;
 	login_config.new_account_flag = true;
+	login_config.new_acc_length_limit = true;
 	login_config.use_md5_passwds = false;
 	login_config.min_level_to_connect = 0;
 	login_config.check_client_version = false;
@@ -1565,6 +1569,8 @@ int login_config_read(const char* cfgName)
 
 		else if(!strcmpi(w1, "new_account"))
 			login_config.new_account_flag = (bool)config_switch(w2);
+		else if(!strcmpi(w1, "new_acc_length_limit"))
+			login_config.new_acc_length_limit = (bool)config_switch(w2);
 		else if(!strcmpi(w1, "start_limited_time"))
 			login_config.start_limited_time = atoi(w2);
 		else if(!strcmpi(w1, "check_client_version"))

+ 1 - 1
src/login/login.h

@@ -61,7 +61,7 @@ struct Login_Config {
 	bool log_login;                                 // whether to log login server actions or not
 	char date_format[32];                           // date format used in messages
 	bool console;                                   // console input system enabled?
-	bool new_account_flag;                          // autoregistration via _M/_F ?
+	bool new_account_flag,new_acc_length_limit;     // autoregistration via _M/_F ? / if yes minimum length is 4?
 	int start_limited_time;                         // new account expiration time (-1: unlimited)
 	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