From: dms Date: Tue, 20 Feb 2001 12:58:24 +0000 (+0000) Subject: - preliminary check of masks in chan for matches. X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7eb2badb4e22b43be61ac2e20cacbc336f71d31d;p=infobot.git - preliminary check of masks in chan for matches. - ckpasswd, clean up. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@405 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/DynaConfig.pl b/blootbot/src/DynaConfig.pl index 398781d..29a44ec 100644 --- a/blootbot/src/DynaConfig.pl +++ b/blootbot/src/DynaConfig.pl @@ -225,7 +225,10 @@ sub readChanFile { $chanconf{$chan}{$1} = 1; } elsif (/^[\s\t]+\-(\S+)$/) { # bool, false. - $chanconf{$chan}{$1} = 0; + &DEBUG("deprecated support of negative options.") unless ($cache{negative}); + # although this is supported in run-time configuration. + $cache{negative} = 1; +# $chanconf{$chan}{$1} = 0; } elsif (/^[\s\t]+(\S+)[\ss\t]+(.*)$/) {# what = val. $chanconf{$chan}{$1} = $2; @@ -247,6 +250,8 @@ sub readChanFile { } } + delete $cache{negative}; + &status("CHANFILE: Loaded: ".(scalar(keys %chanconf)-1)." chans"); } @@ -422,9 +427,14 @@ sub ckpasswd { return 0 unless ($plain ne "" and $encrypted ne ""); # MD5 // DES. Bobby Billingsley++. - my $salt = substr($encrypted, 0, 2); - if ($encrypted =~ /^\$\d\$(\w\w)\$/) { + my $salt; + if ($encrypted =~ /^(\S{2})/ and length $encrypted == 13) { + $salt = $1; + } elsif ($encrypted =~ /^\$\d\$(\w\w)\$/) { $salt = $1; + } else { + &DEBUG("unknown salt from $encrypted."); + return 0; } return ($encrypted eq crypt($plain, $salt)); @@ -542,6 +552,19 @@ sub banAdd { exists $bans{'*'}{$mask}); $bans{$chan}{$mask} = [$expire, time(), 0, $who, $reason]; + my @chans = ($chan eq "*") ? keys %channels : $chan; + my $m = $mask; + $m =~ s/\?/\\./g; + $m =~ s/\*/\\S*/g; + foreach (@chans) { + my $chan = $_; + foreach (keys %{ $channels{$chan}{''} }) { + next unless (exists $nuh{lc $_}); + next unless ($nuh{lc $_} =~ /^$m$/i); + &FIXME("nuh{$_} =~ /$m/"); + } + } + if ($exist == 1) { $utime_userfile = time(); $ucount_userfile++; @@ -709,6 +732,10 @@ my @regFlagsChan = ( ### TODO: finish off this list. ); -my @regFlagsUser = ("mno"); # todo... +my @regFlagsUser = ( + "m", # master + "n", # owner + "o", # op +); # todo... 1;