summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-Trunk.txt4
-rw-r--r--src/login/login.c15
-rw-r--r--src/login_sql/login.c8
-rw-r--r--src/map/atcommand.c5
-rw-r--r--src/map/skill.c2
-rw-r--r--src/map/status.c2
6 files changed, 22 insertions, 14 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 07853209b..be81aca21 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
+2007/01/15
+ * Probably fixed the registration flood protection code being broken.
+ * Joint Break should only re-start the bleeding timer when it currently IS
+ the one that causes bleeding. [Skotlex]
2007/01/12
* Cleaned up the ip rules/DDoS section of the code. (the allow,deny and
deny,allow cases were switched)
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);
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index fbe0acc1d..25bc9bf74 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -471,7 +471,7 @@ int mmo_auth_new(struct mmo_account* account, char sex)
unsigned int tick = gettick();
char user_password[256];
//Account Registration Flood Protection by [Kevin]
- if(tick <= new_reg_tick && num_regs >= allowed_regs) {
+ if(DIFF_TICK(tick, new_reg_tick) < 0 && num_regs >= allowed_regs) {
ShowNotice("Account registration denied (registration limit exceeded)\n");
return 3;
}
@@ -531,10 +531,10 @@ int mmo_auth_new(struct mmo_account* account, char sex)
}
ShowNotice("Updated New account %s's ID %d->%d (account_id must be %d or higher).", account->userid, id, START_ACCOUNT_NUM, START_ACCOUNT_NUM);
}
- if(tick > new_reg_tick)
+ if(DIFF_TICK(tick, new_reg_tick) > 0)
{ //Update the registration check.
num_regs=0;
- new_reg_tick=gettick()+time_allowed*1000;
+ new_reg_tick=tick+time_allowed*1000;
}
num_regs++;
@@ -2398,6 +2398,8 @@ int do_init(int argc,char **argv){
start_console();
}
+ new_reg_tick=gettick();
+
ShowStatus("The login-server is "CL_GREEN"ready"CL_RESET" (Server is listening on the port %d).\n\n", login_port);
return 0;
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index e1c622462..66cb74141 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1342,10 +1342,11 @@ int atcommand_rura(
return -1;
}
- /*if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS)) {
+ if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS))
+ { //This is to prevent the pc_setpos call from printing an error.
clif_displaymessage(fd, msg_txt(2));
x = y = 0; //Invalid cell, use random spot.
- }*/
+ }
if (map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) {
clif_displaymessage(fd, msg_txt(247));
return -1;
diff --git a/src/map/skill.c b/src/map/skill.c
index 81788c88a..25063712a 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -8481,7 +8481,7 @@ int skill_check_condition (struct map_session_data *sd, int skill, int lv, int t
return 0;
}
break;
- case ST_RECOV_WEIGHT_RATE://## what is this for and why can battle_config.natural_heal_weight_rate be 101? [FlavioJS]
+ case ST_RECOV_WEIGHT_RATE:
if(battle_config.natural_heal_weight_rate <= 100 && sd->weight*100/sd->max_weight >= battle_config.natural_heal_weight_rate) {
clif_skill_fail(sd,skill,0,0);
return 0;
diff --git a/src/map/status.c b/src/map/status.c
index a79ff7f89..5683a6218 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -5247,9 +5247,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
break;
case SC_JOINTBEAT:
- val2 |= sc->data[SC_JOINTBEAT].val2; // stackable ailments
if( val2&BREAK_NECK )
sc_start(bl,SC_BLEEDING,100,val1,skill_get_time2(StatusSkillChangeTable[type],val1));
+ val2 |= sc->data[SC_JOINTBEAT].val2; // stackable ailments
break;
case SC_BERSERK: