Ticket #1215: ispcp-vrl-traff.patch2.txt

File ispcp-vrl-traff.patch2.txt, 2.5 kB (added by ispcomm, 5 months ago)

fixed patch for debian/fedora/freebsd.

Line 
1 === ispcp-vrl-traff
2 ==================================================================
3 --- ispcp-vrl-traff     (revision 31)
4 +++ ispcp-vrl-traff     (local)
5 @@ -340,11 +340,11 @@
6
7                 if(exists  $main::cfg{'MAIL_LOG_INC_AMAVIS'} && $main::cfg{'MAIL_LOG_INC_AMAVIS'}) {
8                         # Logs including AMAVIS/SPAMASSASSIN/CLAMAV entries
9 -               $cmd = "$cat $smtp_delivery_log | $awk '{if (\$5 != \"localhost\" && \$6 != \"virtual\" && \$6 != \"localhost\" && \$10 != \"?\") print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log";
10 +               $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log";
11
12                 } else {
13                         # Logs not including AMAVIS/SPAMASSASSIN/CLAMAV entries
14 -           $cmd = "$cat $smtp_delivery_log | $awk '{if (\$5 != \"localhost\" && \$6 != \"localhost\" && \$10 != \"?\") print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log";
15 +           $cmd = "$cat $smtp_delivery_log | $awk '{if ( \$10 != \"?\" && \$6 !~ /virtual/ && !(\$5 ~ /localhost|127.0.0.1/ && \$6 ~ /localhost|127.0.0.1/)) print substr(\$3, index(\$3, \"@\")+1, length(\$3)),substr(\$4, index(\$4, \"@\")+1, length(\$4)),\$10;}' 1>$smtp_log";
16                 }
17
18          $rs = sys_command($cmd);
19 @@ -498,11 +498,12 @@
20
21
22                 # POP3
23 -        $rs = sys_command("$cat $rlog|$grep 'courierpop3login'|$grep 'user='|$grep 'top='|$grep -v 'ip=\\[::ffff:127.0.0.1\\]'|$awk '{print \$7,\$9,substr(\$10,1,length(\$10)-1);}' 1>$pop3_log");
24 +               # courierpop3login is for Debian. pop3d for Fedora.
25 +        $rs = sys_command("$cat $rlog|$grep -E '(courierpop3login|pop3d).+user=.+top='|$grep -v 'ip=\\[::ffff:127.0.0.1\\]'|"
26 +               ."$awk '/courierpop3login/ {print \$7,\$9,substr(\$10,1,length(\$10)-1);} "
27 +                     ."/pop3d/            {print \$7,\$10,substr(\$11,1,length(\$11)-1);}'"
28 +               ." 1>$pop3_log");
29          return $rs if ($rs != 0);
30 -        # for Fedora
31 -        $rs = sys_command("$cat $rlog|$grep 'pop3d'|$grep 'user='|$grep 'top='|$grep -v 'ip=\\[::ffff:127.0.0.1\\]'|$awk '{print \$7,\$10,substr(\$11,1,length(\$11)-1);}' 1>$pop3_log");
32 -        return $rs if ($rs != 0);
33
34          $res = open(F, '<', $pop3_log);
35