mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-27 06:19:25 +01:00
Fix potential race-condition check-ban issue where a server could send a message immediately after someone is banned, causing them to be falsely detected as evading a ban
This commit is contained in:
parent
6bb3e86f33
commit
a4def7d653
@ -533,7 +533,7 @@ sub devalidate_accounts {
|
||||
|
||||
sub check_bans {
|
||||
my ($self, $mask, $channel) = @_;
|
||||
my ($bans, $nickserv_account, $nick, $host);
|
||||
my ($bans, $nickserv_account, $nick, $host, $do_not_validate);
|
||||
|
||||
# $self->{pbot}->logger->log("anti-flood: [check-bans] checking for bans on $mask in $channel\n");
|
||||
|
||||
@ -597,6 +597,13 @@ sub check_bans {
|
||||
|
||||
if(defined $baninfos) {
|
||||
foreach my $baninfo (@$baninfos) {
|
||||
if(time - $baninfo->{when} < 5) {
|
||||
$self->{pbot}->logger->log("anti-flood: [check-bans] $mask evaded $baninfo->{banmask} in $baninfo->{channel}, but within 5 seconds of establishing ban; giving another chance\n");
|
||||
$self->message_history->{$mask}->{channels}->{$channel}{validated} = 0;
|
||||
$do_not_validate = 1;
|
||||
next;
|
||||
}
|
||||
|
||||
if($self->ban_whitelisted($baninfo->{channel}, $baninfo->{banmask})) {
|
||||
$self->{pbot}->logger->log("anti-flood: [check-bans] $mask evaded $baninfo->{banmask} in $baninfo->{channel}, but allowed through whitelist\n");
|
||||
next;
|
||||
@ -641,7 +648,7 @@ sub check_bans {
|
||||
}
|
||||
}
|
||||
|
||||
$self->message_history->{$mask}->{channels}->{$channel}{validated} = 1;
|
||||
$self->message_history->{$mask}->{channels}->{$channel}{validated} = 1 unless $do_not_validate;
|
||||
}
|
||||
|
||||
sub check_nickserv_accounts {
|
||||
|
@ -13,8 +13,8 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 451,
|
||||
BUILD_DATE => "2013-10-13",
|
||||
BUILD_REVISION => 452,
|
||||
BUILD_DATE => "2013-10-14",
|
||||
};
|
||||
|
||||
1;
|
||||
|
Loading…
Reference in New Issue
Block a user