SF.net SVN: logwatch:[283] branches/beta-7-4-2/scripts/services/sendmail
[email protected] Wed, 7 Jan 2015 17:21:44 +0000
| Newsgroups | gmane.comp.log.logwatch.devel |
|---|---|
| Message-ID | <[email protected]> |
Revision: 283
http://sourceforge.net/p/logwatch/code/283
Author: bjorn1
Date: 2015-01-07 17:21:43 +0000 (Wed, 07 Jan 2015)
Log Message:
-----------
Testing for undefineds, and better match for blackholes
Modified Paths:
--------------
branches/beta-7-4-2/scripts/services/sendmail
Modified: branches/beta-7-4-2/scripts/services/sendmail
===================================================================
--- branches/beta-7-4-2/scripts/services/sendmail 2014-12-24 18:09:14 UTC (rev 282)
+++ branches/beta-7-4-2/scripts/services/sendmail 2015-01-07 17:21:43 UTC (rev 283)
@@ -682,12 +682,15 @@
# file=deliver.c, LogLevel>-1, LOG_INFO
} elsif ( ($ToUser, $MailerString, $DeliverStat) = ($ThisLine =~ /^to=(.*?), (.*)stat=(.*)/ ) ) {
if ( $DeliverStat =~ /^Sent/ ) {
- ( ($MailerType) = ( $MailerString =~ /mailer=(.*?),/));
- ( ($RelayName) = ( $MailerString =~ /relay=(.*?),/));
+ ( ($MailerType) = ( $MailerString =~ /mailer=(.*?),/));
+ ( ($RelayName) = ( $MailerString =~ /relay=(.*?),/));
+ if (not defined $MailerType) {
+ $MailerType = "(unspecified)";
+ }
$MailerType =~ s/^\s*$/\(unspecified\)/;
# remove the entries from MSP (Mail Submission Program) relay to
# localhost
- if (($MailerType =~ /^relay$/) and
+ if (($MailerType =~ /^relay$/) && (defined $RelayName) &&
($RelayName =~ /\[127\.0\.0\.1\]/)) {
$RelayLocalhost++;
} else {
@@ -701,12 +704,14 @@
$CleanTo =~ s/\>//g;
$CleanTo =~ s/\"[\w\s]+\"\s?//g;
$CleanTo =~ tr/A-Z/a-z/;
- if (($CleanTo =~ m/\w+\@.+\,\w+/) && ($RelayName !~ m/\[127\.0\.0\.1\]/)) {
+ if (($CleanTo =~ m/\w+\@.+\,\w+/) && (defined $RelayName) &&
+ ($RelayName !~ m/\[127\.0\.0\.1\]/)) {
my @CleanList = split(/,/, $CleanTo);
for my $ListAddr (@CleanList) {
$ToList{$ListAddr}++;
}
- } elsif (($CleanTo =~ m/\w+\@[\w\.]+/) && ($RelayName !~ m/\[127\.0\.0\.1\]/)) {
+ } elsif (($CleanTo =~ m/\w+\@[\w\.]+/) && (defined $RelayName) &&
+ ($RelayName !~ m/\[127\.0\.0\.1\]/)) {
$ToList{$CleanTo}++;
} elsif ($CleanTo =~ m/\w+/) { # Match a simple name
$ToList{$CleanTo}++;
@@ -823,18 +828,18 @@
$Temp = "From " . $1 . " by " . $2;
$BlackHoled{$Temp}++;
$BlackHoles{$2}++;
- } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /^ruleset=(?:check_relay|check_rcpt), arg1=[^,]*,(?: arg2=[^,]*,)? relay=([^,]*), reject=55\d\s*[\d.]*\s*.*http:\/\/([^\/]*)\//) ) {
+ } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /^ruleset=(?:check_relay|check_rcpt), arg1=[^,]*,(?: arg2=[^,]*,)? relay=([^,]*), reject=55\d\s*[\d.]*\s*.*http:\/\/([^\/\s]*)/) ) {
$Temp = "From " . $Relay . " by " . $BlSite;
$BlackHoled{$Temp}++;
$BlackHoles{$BlSite}++;
- } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /^ruleset=(?:check_relay|check_rcpt), arg1=([^,]*),(?: arg2=[^,]*,)? reject=55\d\s*[\d.]*\s*.*http:\/\/([^\/]*)\//) ) {
+ } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /^ruleset=(?:check_relay|check_rcpt), arg1=([^,]*),(?: arg2=[^,]*,)? reject=55\d\s*[\d.]*\s*.*http:\/\/([^\/\s]*)/) ) {
#Example 553 error with NO RELAY -mgt
#ruleset=check_relay, arg1=s010600402b39ee29.vf.shawcable.net, arg2=127.0.0.2, reject=553 5.3.0
#Spam blocked see: http://spamcop.net/bl.shtml?70.68.8.182: 1 Time(s)
$Temp = "From " . $Relay . " by " . $BlSite;
$BlackHoled{$Temp}++;
$BlackHoles{$BlSite}++;
- } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /reject=553\s*[\d.]*\s*<[^ ]*>\.\.\. +Mail from ([\d\.]+) rejected\;see http:\/\/([^\/]*)\//) ) {
+ } elsif ( ($Relay,$BlSite) = ($ThisLine =~ /reject=553\s*[\d.]*\s*<[^ ]*>\.\.\. +Mail from ([\d\.]+) rejected\;see http:\/\/([^\/\s]*)/) ) {
#This is the another blackhole tag -mgt
$Temp = "From " . $Relay . " by " . $BlSite;
$BlackHoled{$Temp}++;
@@ -893,7 +898,7 @@
}
# similarly, delete last unmatched entry when too many bad commands
} elsif ( $ThisLine =~ /^--- 421 4\.\d\.\d .* Too many bad commands; closing connection$/) {
- if ($OtherList{$LastCmd{$QueueID}}) {
+ if (defined $OtherList{$LastCmd{$QueueID}}) {
delete ($OtherList{$LastCmd{$QueueID}});
}
@@ -903,7 +908,7 @@
# file=srvrsmtp.c, LogLevel>5, LOG_INFO
} elsif ( ( $Host ) = ($ThisLine =~ /(.*) (\(may be forged\) )?did not issue MAIL\/EXPN\/VRFY\/ETRN during connection to /) ) {
# we test if they previously sent junk, because the connection is expected to fail
- if ($CommandUnrecognized{$QueueID}) {
+ if (defined $CommandUnrecognized{$QueueID}) {
$CommandUnrecognized{$QueueID} = $CommandUnrecognized{$QueueID} . " ... and then exited without communicating\n";
} else {
$DummyConnection{$Host}++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net