From 7e846149c4eed7bead8214199eebc637a66b6333 Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Tue, 2 May 2017 18:34:27 +0200 Subject: [PATCH] Import postscreen support patch provided by Matus Uhlar d/patches/postscreen-rejects (Closes: #861402) --- debian/changelog | 7 +++++ debian/patches/postscreen-rejects | 43 +++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 51 insertions(+) create mode 100644 debian/patches/postscreen-rejects diff --git a/debian/changelog b/debian/changelog index f74f173..0792b16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 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 index 0000000..aedb249 --- /dev/null +++ b/debian/patches/postscreen-rejects @@ -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 { diff --git a/debian/patches/series b/debian/patches/series index ff96ea0..4a0cb6d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1 +1,2 @@ kill-dot-pl +postscreen-rejects -p0 -- 2.39.2