From: Ian Jackson Date: Wed, 26 Jan 2011 16:27:09 +0000 (+0000) Subject: stump: fix hideous bug where passlisting someone puts their whole From: line in the... X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~webstump/git?p=modbot-mtm.git;a=commitdiff_plain;h=e34b76824b88b3240efc0509ebcd110a26687ab0 stump: fix hideous bug where passlisting someone puts their whole From: line in the passlist, but this is later interpreted as a regexp --- diff --git a/webstump/scripts/filter.lib.pl b/webstump/scripts/filter.lib.pl index 8aef45f..a490c5a 100644 --- a/webstump/scripts/filter.lib.pl +++ b/webstump/scripts/filter.lib.pl @@ -44,6 +44,7 @@ print STDERR "DECISION: $newsgroup | $ShortDirectoryName | $decision | $cathow | # against the substrings as regexps and substrings as literal substrings. # # Arguments: address, listname + sub name_is_in_list { # address, listname my $listName = pop( @_ ); my $address = pop( @_ ); @@ -51,20 +52,23 @@ sub name_is_in_list { # address, listname my $item = ""; my $Result = ""; - $address = "\L$address"; - open( LIST, &full_config_file_name( $listName ) ) || return ""; while( $item = ) { - chop $item; + chomp $item; - next if $item =~ /^\s*$/; + next unless $item =~ /\S/; + next if $item =~ /^\s*\#/; - my $quoted_item = quotemeta( $item ); - - if( eval { $address =~ /$item/i; } || $address =~ /$quoted_item/i ) { - $Result = $item; + if ($listName eq 'good.posters.list') { + if( lc $address eq lc $item ) { + $Result = $item; + } + } else { + if( eval { $address =~ /$item/i; } ) { + $Result = $item; + } } } @@ -73,7 +77,6 @@ sub name_is_in_list { # address, listname return $Result; } - ###################################################################### # reviews incoming message and decides: approve, reject, keep # in queue for human review