summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/login_athena.conf6
-rw-r--r--src/login/login.c13
-rw-r--r--src/login/login.h1
3 files changed, 18 insertions, 2 deletions
diff --git a/conf/login_athena.conf b/conf/login_athena.conf
index 7dda3cb5c..5c2afa8d9 100644
--- a/conf/login_athena.conf
+++ b/conf/login_athena.conf
@@ -67,6 +67,12 @@ date_format: %Y-%m-%d %H:%M:%S
// 0 or more: group id
group_id_to_connect: -1
+// Minimum account group id required to connect to server.
+// Will not function if group_id_to_connect config is enabled.
+// -1: disabled
+// 0 or more: group id
+min_group_id_to_connect: -1
+
// Starting additional sec from now for the limited time at creation of account
// -1: new account are created with UNlimited time (default value)
// 0 or more: new accounts was created by addition of the value (in sec) to the actual time (to set first limited time)
diff --git a/src/login/login.c b/src/login/login.c
index 6b4e8948e..687dd172c 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -1112,14 +1112,20 @@ void login_auth_ok(struct login_session_data* sd)
return;
}
- if( login_config.group_id_to_connect >= 0 && sd->group_id != login_config.group_id_to_connect )
- {
+ if( login_config.group_id_to_connect >= 0 && sd->group_id != login_config.group_id_to_connect ) {
ShowStatus("Connection refused: the required group id for connection is %d (account: %s, group: %d).\n", login_config.group_id_to_connect, sd->userid, sd->group_id);
WFIFOHEAD(fd,3);
WFIFOW(fd,0) = 0x81;
WFIFOB(fd,2) = 1; // 01 = Server closed
WFIFOSET(fd,3);
return;
+ } else if( login_config.min_group_id_to_connect >= 0 && login_config.group_id_to_connect == -1 && sd->group_id < login_config.min_group_id_to_connect ) {
+ ShowStatus("Connection refused: the minium group id required for connection is %d (account: %s, group: %d).\n", login_config.min_group_id_to_connect, sd->userid, sd->group_id);
+ WFIFOHEAD(fd,3);
+ WFIFOW(fd,0) = 0x81;
+ WFIFOB(fd,2) = 1; // 01 = Server closed
+ WFIFOSET(fd,3);
+ return;
}
server_num = 0;
@@ -1538,6 +1544,7 @@ void login_set_defaults()
login_config.new_acc_length_limit = true;
login_config.use_md5_passwds = false;
login_config.group_id_to_connect = -1;
+ login_config.min_group_id_to_connect = -1;
login_config.check_client_version = false;
login_config.client_version_to_connect = 20;
@@ -1606,6 +1613,8 @@ int login_config_read(const char* cfgName)
login_config.use_md5_passwds = (bool)config_switch(w2);
else if(!strcmpi(w1, "group_id_to_connect"))
login_config.group_id_to_connect = atoi(w2);
+ else if(!strcmpi(w1, "min_group_id_to_connect"))
+ login_config.min_group_id_to_connect = atoi(w2);
else if(!strcmpi(w1, "date_format"))
safestrncpy(login_config.date_format, w2, sizeof(login_config.date_format));
else if(!strcmpi(w1, "console"))
diff --git a/src/login/login.h b/src/login/login.h
index 384372c75..2092e6e71 100644
--- a/src/login/login.h
+++ b/src/login/login.h
@@ -65,6 +65,7 @@ struct Login_Config {
int start_limited_time; // new account expiration time (-1: unlimited)
bool use_md5_passwds; // work with password hashes instead of plaintext passwords?
int group_id_to_connect; // required group id to connect
+ int min_group_id_to_connect; // minimum group id to connect
bool check_client_version; // check the clientversion set in the clientinfo ?
uint32 client_version_to_connect; // the client version needed to connect (if checking is enabled)