|
@@ -1193,14 +1193,11 @@ int mmo_auth(struct mmo_account* account, int fd) {
|
|
&& new_account_flag && account_id_count <= END_ACCOUNT_NUM && len >= 4 && strlen(account->passwd) >= 4) {
|
|
&& new_account_flag && account_id_count <= END_ACCOUNT_NUM && len >= 4 && strlen(account->passwd) >= 4) {
|
|
|
|
|
|
//only continue if amount in this time limit is allowed (account registration flood protection)[Kevin]
|
|
//only continue if amount in this time limit is allowed (account registration flood protection)[Kevin]
|
|
- if(gettick() <= new_reg_tick && num_regs >= allowed_regs) {
|
|
|
|
|
|
+ if(DIFF_TICK(gettick(), new_reg_tick) < 0 && num_regs >= allowed_regs) {
|
|
ShowNotice("Account registration denied (registration limit exceeded) to %s!\n", ip);
|
|
ShowNotice("Account registration denied (registration limit exceeded) to %s!\n", ip);
|
|
login_log("Notice: Account registration denied (registration limit exceeded) to %s!", ip);
|
|
login_log("Notice: Account registration denied (registration limit exceeded) to %s!", ip);
|
|
return 3;
|
|
return 3;
|
|
- } else {
|
|
|
|
- num_regs=0;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
newaccount = 1;
|
|
newaccount = 1;
|
|
account->userid[len] = '\0';
|
|
account->userid[len] = '\0';
|
|
}
|
|
}
|
|
@@ -1359,13 +1356,15 @@ int mmo_auth(struct mmo_account* account, int fd) {
|
|
return 0; // 0 = Unregistered ID
|
|
return 0; // 0 = Unregistered ID
|
|
} else {
|
|
} else {
|
|
int new_id = mmo_auth_new(account, account->userid[len+1], "a@a.com");
|
|
int new_id = mmo_auth_new(account, account->userid[len+1], "a@a.com");
|
|
|
|
+ unsigned int tick = gettick();
|
|
login_log("Account creation and authentification accepted (account %s (id: %d), pass: %s, sex: %c, connection with _F/_M, ip: %s)" RETCODE,
|
|
login_log("Account creation and authentification accepted (account %s (id: %d), pass: %s, sex: %c, connection with _F/_M, ip: %s)" RETCODE,
|
|
account->userid, new_id, account->passwd, account->userid[len+1], ip);
|
|
account->userid, new_id, account->passwd, account->userid[len+1], ip);
|
|
auth_before_save_file = 0; // Creation of an account -> save accounts file immediatly
|
|
auth_before_save_file = 0; // Creation of an account -> save accounts file immediatly
|
|
|
|
|
|
- //restart ticker (account registration flood protection)[Kevin]
|
|
|
|
- if(num_regs==0) {
|
|
|
|
- new_reg_tick=gettick()+time_allowed*1000;
|
|
|
|
|
|
+ if(DIFF_TICK(tick, new_reg_tick) > 0)
|
|
|
|
+ { //Update the registration check.
|
|
|
|
+ num_regs = 0;
|
|
|
|
+ new_reg_tick=tick +time_allowed*1000;
|
|
}
|
|
}
|
|
num_regs++;
|
|
num_regs++;
|
|
}
|
|
}
|
|
@@ -4192,6 +4191,8 @@ int do_init(int argc, char **argv) {
|
|
start_console();
|
|
start_console();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ new_reg_tick=gettick();
|
|
|
|
+
|
|
login_log("The login-server is ready (Server is listening on the port %d)." RETCODE, login_port);
|
|
login_log("The login-server is ready (Server is listening on the port %d)." RETCODE, login_port);
|
|
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", login_port);
|
|
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", login_port);
|
|
|
|
|