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 --- src/login/login.c | 6 ++++++ src/login/login.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src/login') 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-60-g2f50