From ed515875f2fc77a3c77deaf94fe5de619cb53e01 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sun, 9 Aug 2009 10:58:37 +0200 Subject: Multi::IRC: Fixed authentication level checking bug Everyone had access to the commands with the |8 flag enabled. Oops! --- lib/Multi/IRC.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/Multi/IRC.pm') diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm index 6b3a1dbb..ff122405 100644 --- a/lib/Multi/IRC.pm +++ b/lib/Multi/IRC.pm @@ -218,12 +218,13 @@ sub command { # mask, dest, msg my($cmd, $arg) = ($1, $2); return 0 if !exists $_[HEAP]{commands}{$cmd} || ($_[HEAP]{commands}{$cmd} & 8) && !$addressed; + my $lvl = $_[HEAP]{commands}{$cmd} & ~8; my $usr = parse_user($mask); return $_[KERNEL]->yield(reply => $dest, - $dest eq $_[HEAP]{channels}[0] ? 'Only OPs can do that!' : "Only $_[HEAP]{channel}[0] OPs can do that!", $usr) || 1 - if $_[HEAP]{commands}{$cmd} == 1 && !$irc->is_channel_operator($_[HEAP]{channels}[0], $usr); + $dest->[0] eq $_[HEAP]{channels}[0] ? 'Only OPs can do that!' : "Only $_[HEAP]{channel}[0] OPs can do that!", $usr) || 1 + if $lvl == 1 && !$irc->is_channel_operator($_[HEAP]{channels}[0], $usr); return $_[KERNEL]->yield(reply => $dest, 'You are not my master!', $usr) || 1 - if $_[HEAP]{commands}{$cmd} == 2 && !grep matches_mask($_, $mask), @{$_[HEAP]{masters}}; + if $lvl == 2 && !grep matches_mask($_, $mask), @{$_[HEAP]{masters}}; return $_[KERNEL]->yield('cmd_'.$cmd, $usr, $dest, $arg, $mask) || 1; } -- cgit v1.2.3