Import postscreen support patch provided by Matus Uhlar d/patches/postscreen-rejects...
authorSven Hoexter <sven.hoexter@rewe-digital.com>
Tue, 2 May 2017 16:34:27 +0000 (18:34 +0200)
committerSven Hoexter <sven.hoexter@rewe-digital.com>
Tue, 2 May 2017 16:34:27 +0000 (18:34 +0200)
debian/changelog
debian/patches/postscreen-rejects [new file with mode: 0644]
debian/patches/series

index f74f173..0792b16 100644 (file)
@@ -1,3 +1,10 @@
+pflogsumm (1.1.5-3) UNRELEASED; urgency=medium
+
+  * Import postscreen support patch provided by Matus Uhlar
+    d/patches/postscreen-rejects (Closes: #861402)
+
+ -- Sven Hoexter <hoexter@debian.org>  Tue, 02 May 2017 18:32:14 +0200
+
 pflogsumm (1.1.5-2) unstable; urgency=low
 
   * Increase Standards-Version to 3.9.8 - no  changes required.
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 {
index ff96ea0..4a0cb6d 100644 (file)
@@ -1 +1,2 @@
 kill-dot-pl
+postscreen-rejects -p0