summaryrefslogtreecommitdiff
path: root/src/login/login.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-15 16:43:01 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-01-15 16:43:01 +0000
commit7c66f59d7fa170410b8a046008b48b6d67fa36d7 (patch)
treeb37cf453885a28a3b277c0b5ab612770328a077d /src/login/login.c
parent320b8e22f24cf05fe179fdf4da0f129930986482 (diff)
downloadhercules-7c66f59d7fa170410b8a046008b48b6d67fa36d7.tar.gz
hercules-7c66f59d7fa170410b8a046008b48b6d67fa36d7.tar.bz2
hercules-7c66f59d7fa170410b8a046008b48b6d67fa36d7.tar.xz
hercules-7c66f59d7fa170410b8a046008b48b6d67fa36d7.zip
- Probably fixed the registration flood protection code being broken.
- Readded a commented piece of code that's meant to prevent @warp from printing "invalid target cell!" messages on the console. - Joint Break should only re-start the bleeding timer when it currently IS the one that causes bleeding. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9653 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login/login.c')
-rw-r--r--src/login/login.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/login/login.c b/src/login/login.c
index 84d6afd0f..98e6ce038 100644
--- a/src/login/login.c
+++ b/src/login/login.c
@@ -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) {
//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);
login_log("Notice: Account registration denied (registration limit exceeded) to %s!", ip);
return 3;
- } else {
- num_regs=0;
}
-
newaccount = 1;
account->userid[len] = '\0';
}
@@ -1359,13 +1356,15 @@ int mmo_auth(struct mmo_account* account, int fd) {
return 0; // 0 = Unregistered ID
} else {
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,
account->userid, new_id, account->passwd, account->userid[len+1], ip);
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++;
}
@@ -4192,6 +4191,8 @@ int do_init(int argc, char **argv) {
start_console();
}
+ new_reg_tick=gettick();
+
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);