]> git.sven.stormbind.net Git - sven/pflogsumm.git/blobdiff - debian/patches/postscreen-rejects
Import postscreen support patch provided by Matus Uhlar d/patches/postscreen-rejects...
[sven/pflogsumm.git] / debian / patches / postscreen-rejects
diff --git a/debian/patches/postscreen-rejects b/debian/patches/postscreen-rejects
new file mode 100644 (file)
index 0000000..aedb249
--- /dev/null
@@ -0,0 +1,43 @@
+Index: pflogsumm.pl
+===================================================================
+--- pflogsumm.pl.orig
++++ pflogsumm.pl
+@@ -713,7 +713,7 @@ while(<>) {
+                         \${$msgsPerDay{$revMsgDateStr}}[4]);
+     } elsif($cmd eq 'master') {
+       ++$masterMsgs{(split(/^.*master.*: /, $logRmdr))[1]};
+-    } elsif($cmd eq 'smtpd') {
++    } elsif($cmd eq 'smtpd' || $cmd eq 'postscreen') {
+       if($logRmdr =~ /\[\d+\]: \w+: client=(.+?)(,|$)/) {
+           #
+           # Warning: this code in two places!
+@@ -1536,14 +1536,14 @@ sub gimme_domain {
+     # split domain/ipaddr into separates
+     # newer versions of Postfix have them "dom.ain[i.p.add.ress]"
+     # older versions of Postfix have them "dom.ain/i.p.add.ress"
+-    unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2 ||
+-           (($domain, $ipAddr) = /^([^\/]+)\/([0-9a-f.:]+)/i) == 2) {
++    unless((($domain, $ipAddr) = /^([^\[]*)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2||
++           (($domain, $ipAddr) = /^([^\/]*)\/([0-9a-f.:]+)/i) == 2) {
+       # more exhaustive method
+         ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/;
+     }
+  
+     # "mach.host.dom"/"mach.host.do.co" to "host.dom"/"host.do.co"
+-    if($domain eq 'unknown') {
++    if($domain eq "" || $domain eq 'unknown') {
+         $domain = $ipAddr;
+       # For identifying the host part on a Class C network (commonly
+       # seen with dial-ups) the following is handy.
+@@ -1656,9 +1656,10 @@ sub proc_smtpd_reject {
+           # those--incl. stuff that'll screw up subsequent parsing.  So just
+           # get rid of it right off.
+           $rejReas =~ s/^(\d{3} <).*?(>:)/$1$2/;
++          $rejReas =~ s/^(?:\d{3} \d\.\d\.\d )(Protocol error);.*$/$1/;
+           $rejReas =~ s/^(?:.*?[:;] )(?:\[[^\]]+\] )?([^;,]+)[;,].*$/$1/;
+           $rejReas =~ s/^((?:Sender|Recipient) address rejected: [^:]+):.*$/$1/;
+-          $rejReas =~ s/(Client host|Sender address) .+? blocked/blocked/;
++          $rejReas =~ s/(client|Client host|Sender address) .+? blocked/blocked/;
+       } elsif($rejTyp eq "MAIL") {    # *more* special treatment :-( grrrr...
+           $rejReas =~ s/^\d{3} (?:<.+>: )?([^;:]+)[;:]?.*$/$1/;
+       } else {