From ded3beb31fd3aa57ce15ea85effeda5c329a3343 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Sun, 25 Dec 2011 10:36:33 +0000 Subject: 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15265 54d463be-8e91-2dee-dedb-b68131a5f0ec --- conf/login_athena.conf | 4 ++++ src/login/login.c | 6 ++++++ src/login/login.h | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/conf/login_athena.conf b/conf/login_athena.conf index 7f1f40d4b..7ee08881b 100644 --- a/conf/login_athena.conf +++ b/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 diff --git a/src/login/login.c b/src/login/login.c index e57293a4c..a8abef1c7 100644 --- a/src/login/login.c +++ b/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")) diff --git a/src/login/login.h b/src/login/login.h index 07f05f18b..3f14ec93c 100644 --- a/src/login/login.h +++ b/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 -- cgit v1.2.3-70-g09d2