"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/Mail/SpamAssassin/Plugin/URIDetail.pm" between
Mail-SpamAssassin-3.4.4.tar.bz2 and Mail-SpamAssassin-3.4.5.tar.bz2

About: SpamAssassin is a mail filter that uses a wide range of heuristic tests on mail headers and body text to identify "spam" (also known as unsolicited commercial email) incl. Bayesian (statistical) spam filter and several internet-based realtime blacklists.

URIDetail.pm  (Mail-SpamAssassin-3.4.4.tar.bz2):URIDetail.pm  (Mail-SpamAssassin-3.4.5.tar.bz2)
skipping to change at line 53 skipping to change at line 53
faked type which specifies that the raw_uri was parsed from the faked type which specifies that the raw_uri was parsed from the
rendered text. rendered text.
C<cleaned> is a list including the raw URI and various cleaned C<cleaned> is a list including the raw URI and various cleaned
versions of the raw URI (http://spamassassin.apache%2Eorg/, versions of the raw URI (http://spamassassin.apache%2Eorg/,
https://spamassassin.apache.org/). https://spamassassin.apache.org/).
C<text> is the anchor text(s) (text between <a> and </a>) that C<text> is the anchor text(s) (text between <a> and </a>) that
linked to the raw URI. linked to the raw URI.
C<domain> is the domain(s) found in the cleaned URIs. C<domain> is the domain(s) found in the cleaned URIs, as trimmed to
registrar boundary by Mail::SpamAssassin::Util::RegistrarBoundaries(3).
C<host> is the full host(s) in the cleaned URIs. (Supported since SA 3.4.5)
Example rule for matching a URI where the raw URI matches "%2Ebar", Example rule for matching a URI where the raw URI matches "%2Ebar",
the domain "bar.com" is found, and the type is "a" (an anchor tag). the domain "bar.com" is found, and the type is "a" (an anchor tag).
uri_detail TEST1 raw =~ /%2Ebar/ domain =~ /^bar\.com$/ type =~ /^a$/ uri_detail TEST1 raw =~ /%2Ebar/ domain =~ /^bar\.com$/ type =~ /^a$/
Example rule to look for suspicious "https" links: Example rule to look for suspicious "https" links:
uri_detail FAKE_HTTPS text =~ /\bhttps:/ cleaned !~ /\bhttps:/ uri_detail FAKE_HTTPS text =~ /\bhttps:/ cleaned !~ /\bhttps:/
skipping to change at line 122 skipping to change at line 125
my $name = $1; my $name = $1;
my $def = $2; my $def = $2;
my $added_criteria = 0; my $added_criteria = 0;
# if this matches a regex, it strips slashes # if this matches a regex, it strips slashes
while ($def =~ m{\b(\w+)\b\s*([\=\!]\~)\s*((?:/.*?/|m(\W).*?\4)[imsx]*)(?= \s|$)}g) { while ($def =~ m{\b(\w+)\b\s*([\=\!]\~)\s*((?:/.*?/|m(\W).*?\4)[imsx]*)(?= \s|$)}g) {
my $target = $1; my $target = $1;
my $op = $2; my $op = $2;
my $pattern = $3; my $pattern = $3;
if ($target !~ /^(?:raw|type|cleaned|text|domain)$/) { if ($target !~ /^(?:raw|type|cleaned|text|domain|host)$/) {
return $Mail::SpamAssassin::Conf::INVALID_VALUE; return $Mail::SpamAssassin::Conf::INVALID_VALUE;
} }
my ($rec, $err) = compile_regexp($pattern, 1); my ($rec, $err) = compile_regexp($pattern, 1);
if (!$rec) { if (!$rec) {
dbg("config: uri_detail invalid regexp '$pattern': $err"); dbg("config: uri_detail invalid regexp '$pattern': $err");
return $Mail::SpamAssassin::Conf::INVALID_VALUE; return $Mail::SpamAssassin::Conf::INVALID_VALUE;
} }
dbg("config: uri_detail adding ($target $op /$rec/) to $name"); dbg("config: uri_detail adding ($target $op /$rec/) to $name");
skipping to change at line 223 skipping to change at line 226
my($op,$patt) = @{$rule->{domain}}; my($op,$patt) = @{$rule->{domain}};
my $match; my $match;
for my $text (keys %{ $info->{domains} }) { for my $text (keys %{ $info->{domains} }) {
if ( ($op eq '=~' && $text =~ $patt) || if ( ($op eq '=~' && $text =~ $patt) ||
($op eq '!~' && $text !~ $patt) ) { $match = $text; last } ($op eq '!~' && $text !~ $patt) ) { $match = $text; last }
} }
next unless defined $match; next unless defined $match;
dbg("uri: domain matched: '%s' %s /%s/", $match,$op,$patt); dbg("uri: domain matched: '%s' %s /%s/", $match,$op,$patt);
} }
if (exists $rule->{host}) {
next unless $info->{hosts};
my($op,$patt) = @{$rule->{host}};
my $match;
for my $text (keys %{ $info->{hosts} }) {
if ( ($op eq '=~' && $text =~ $patt) ||
($op eq '!~' && $text !~ $patt) ) { $match = $text; last }
}
next unless defined $match;
dbg("uri: host matched: '%s' %s /%s/", $match,$op,$patt);
}
if (would_log('dbg', 'rules') > 1) { if (would_log('dbg', 'rules') > 1) {
dbg("uri: criteria for $test met"); dbg("uri: criteria for $test met");
} }
$permsg->got_hit($test); $permsg->got_hit($test);
# reset hash # reset hash
keys %uri_detail; keys %uri_detail;
return 0; return 0;
} }
return 0; return 0;
} }
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
sub has_host_key { 1 } # can match with "host" key
1; 1;
 End of changes. 4 change blocks. 
2 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)