Added 'ipban_cleanup_interval' option which determines how often expired IP bans are cleaned from the database. (bugreport:3734)
Modified ipban_check() to only include ipbans that haven't already expired. (bugreport:3734) git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14161 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
40a9a236c0
commit
d2313b836b
@ -3,6 +3,9 @@ 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.
|
||||
|
||||
2009/11/22
|
||||
* Added 'ipban_cleanup_interval' option which determines how often expired IP bans are cleaned from the database. (bugreport:3734) [Paradox924X]
|
||||
* Modified ipban_check() to only include ipbans that haven't already expired. (bugreport:3734) [Paradox924X]
|
||||
2009/11/20
|
||||
* Cleaned up mapreg dirty-marking code to only mark the mapreg as dirty when it actually is. (bugreport:3735) [Paradox924X]
|
||||
2009/11/19
|
||||
|
@ -102,6 +102,11 @@ ipban.dynamic_pass_failure_ban_interval: 5
|
||||
ipban.dynamic_pass_failure_ban_limit: 7
|
||||
ipban.dynamic_pass_failure_ban_duration: 5
|
||||
|
||||
// Interval (in seconds) to clean up expired IP bans. 0 = disabled. default = 60.
|
||||
// NOTE: Even if this is disabled, expired IP bans will be cleaned up on login server start/stop.
|
||||
// Players will still be able to login if an ipban entry exists but the expiration time has already passed.
|
||||
ipban_cleanup_interval: 60
|
||||
|
||||
// Interval (in minutes) to execute a DNS/IP update. Disabled by default.
|
||||
// Enable it if your server uses a dynamic IP which changes with time.
|
||||
//ip_sync_interval: 10
|
||||
|
@ -83,9 +83,12 @@ void ipban_init(void)
|
||||
if( codepage[0] != '\0' && SQL_ERROR == Sql_SetEncoding(sql_handle, codepage) )
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
||||
// set up periodic cleanup of connection history and active bans
|
||||
add_timer_func_list(ipban_cleanup, "ipban_cleanup");
|
||||
cleanup_timer_id = add_timer_interval(gettick()+10, ipban_cleanup, 0, 0, 60*1000);
|
||||
if( login_config.ipban_cleanup_interval > 0 )
|
||||
{ // set up periodic cleanup of connection history and active bans
|
||||
add_timer_func_list(ipban_cleanup, "ipban_cleanup");
|
||||
cleanup_timer_id = add_timer_interval(gettick()+10, ipban_cleanup, 0, 0, login_config.ipban_cleanup_interval*1000);
|
||||
} else // make sure it gets cleaned up on login-server start regardless of interval-based cleanups
|
||||
ipban_cleanup(0,0,0,0);
|
||||
}
|
||||
|
||||
// finalize
|
||||
@ -94,8 +97,11 @@ void ipban_final(void)
|
||||
if( !login_config.ipban )
|
||||
return;// ipban disabled
|
||||
|
||||
// release data
|
||||
delete_timer(cleanup_timer_id, ipban_cleanup);
|
||||
if( login_config.ipban_cleanup_interval > 0 )
|
||||
// release data
|
||||
delete_timer(cleanup_timer_id, ipban_cleanup);
|
||||
|
||||
ipban_cleanup(0,0,0,0); // always clean up on login-server stop
|
||||
|
||||
// close connections
|
||||
Sql_Free(sql_handle);
|
||||
@ -201,7 +207,7 @@ bool ipban_check(uint32 ip)
|
||||
if( !login_config.ipban )
|
||||
return false;// ipban disabled
|
||||
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `list` = '%u.*.*.*' OR `list` = '%u.%u.*.*' OR `list` = '%u.%u.%u.*' OR `list` = '%u.%u.%u.%u'",
|
||||
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT count(*) FROM `%s` WHERE `rtime` > NOW() AND (`list` = '%u.*.*.*' OR `list` = '%u.%u.*.*' OR `list` = '%u.%u.%u.*' OR `list` = '%u.%u.%u.%u')",
|
||||
ipban_table, p[3], p[3], p[2], p[3], p[2], p[1], p[3], p[2], p[1], p[0]) )
|
||||
{
|
||||
Sql_ShowDebug(sql_handle);
|
||||
|
@ -1474,6 +1474,7 @@ void login_set_defaults()
|
||||
{
|
||||
login_config.login_ip = INADDR_ANY;
|
||||
login_config.login_port = 6900;
|
||||
login_config.ipban_cleanup_interval = 60;
|
||||
login_config.ip_sync_interval = 0;
|
||||
login_config.log_login = true;
|
||||
safestrncpy(login_config.date_format, "%Y-%m-%d %H:%M:%S", sizeof(login_config.date_format));
|
||||
@ -1559,6 +1560,8 @@ int login_config_read(const char* cfgName)
|
||||
login_config.use_dnsbl = (bool)config_switch(w2);
|
||||
else if(!strcmpi(w1, "dnsbl_servers"))
|
||||
safestrncpy(login_config.dnsbl_servs, w2, sizeof(login_config.dnsbl_servs));
|
||||
else if(!strcmpi(w1, "ipban_cleanup_interval"))
|
||||
login_config.ipban_cleanup_interval = (unsigned int)atoi(w2);
|
||||
else if(!strcmpi(w1, "ip_sync_interval"))
|
||||
login_config.ip_sync_interval = (unsigned int)1000*60*atoi(w2); //w2 comes in minutes.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user