]> git.sven.stormbind.net Git - sven/pflogsumm.git/blob - debian/patches/postscreen-rejects
74e56fd6961c31ac615fc7095ca812fe7b0879b6
[sven/pflogsumm.git] / debian / patches / postscreen-rejects
1 Index: pflogsumm.pl
2 ===================================================================
3 --- pflogsumm.orig/pflogsumm.pl
4 +++ pflogsumm/pflogsumm.pl
5 @@ -713,7 +713,7 @@ while(<>) {
6                           \${$msgsPerDay{$revMsgDateStr}}[4]);
7      } elsif($cmd eq 'master') {
8         ++$masterMsgs{(split(/^.*master.*: /, $logRmdr))[1]};
9 -    } elsif($cmd eq 'smtpd') {
10 +    } elsif($cmd eq 'smtpd' || $cmd eq 'postscreen') {
11         if($logRmdr =~ /\[\d+\]: \w+: client=(.+?)(,|$)/) {
12             #
13             # Warning: this code in two places!
14 @@ -1536,14 +1536,14 @@ sub gimme_domain {
15      # split domain/ipaddr into separates
16      # newer versions of Postfix have them "dom.ain[i.p.add.ress]"
17      # older versions of Postfix have them "dom.ain/i.p.add.ress"
18 -    unless((($domain, $ipAddr) = /^([^\[]+)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2 ||
19 -           (($domain, $ipAddr) = /^([^\/]+)\/([0-9a-f.:]+)/i) == 2) {
20 +    unless((($domain, $ipAddr) = /^([^\[]*)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2||
21 +           (($domain, $ipAddr) = /^([^\/]*)\/([0-9a-f.:]+)/i) == 2) {
22         # more exhaustive method
23          ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/;
24      }
25   
26      # "mach.host.dom"/"mach.host.do.co" to "host.dom"/"host.do.co"
27 -    if($domain eq 'unknown') {
28 +    if($domain eq "" || $domain eq 'unknown') {
29          $domain = $ipAddr;
30         # For identifying the host part on a Class C network (commonly
31         # seen with dial-ups) the following is handy.
32 @@ -1656,9 +1656,10 @@ sub proc_smtpd_reject {
33             # those--incl. stuff that'll screw up subsequent parsing.  So just
34             # get rid of it right off.
35             $rejReas =~ s/^(\d{3} <).*?(>:)/$1$2/;
36 +           $rejReas =~ s/^(?:\d{3} \d\.\d\.\d )(Protocol error);.*$/$1/;
37             $rejReas =~ s/^(?:.*?[:;] )(?:\[[^\]]+\] )?([^;,]+)[;,].*$/$1/;
38             $rejReas =~ s/^((?:Sender|Recipient) address rejected: [^:]+):.*$/$1/;
39 -           $rejReas =~ s/(Client host|Sender address) .+? blocked/blocked/;
40 +           $rejReas =~ s/(client|Client host|Sender address) .+? blocked/blocked/;
41         } elsif($rejTyp eq "MAIL") {    # *more* special treatment :-( grrrr...
42             $rejReas =~ s/^\d{3} (?:<.+>: )?([^;:]+)[;:]?.*$/$1/;
43         } else {