SF.net SVN: logwatch:[158] scripts/services/exim

[email protected]
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 158
          http://sourceforge.net/p/logwatch/code/158
Author:   stefjakobs
Date:     2013-08-19 09:17:57 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
exim: add ipv6 support; fixes debian bug 708197 (thanks Willi Mann)

Modified Paths:
--------------
    scripts/services/exim

Modified: scripts/services/exim
===================================================================
--- scripts/services/exim	2013-08-01 10:05:24 UTC (rev 157)
+++ scripts/services/exim	2013-08-19 09:17:57 UTC (rev 158)
@@ -116,6 +116,10 @@
 $StartQueue = 0;
 $EndQueue = 0;
 
+# Regex to match IPv4 addresses and IPv6 addresses
+# IPv6 part could be made more strict
+my $IPAddress = qr/\d+\.\d+\.\d+\.\d+|[a-fA-F0-9]*:[a-fA-F0-9:]+/;
+
 while (defined($ThisLine = <STDIN>)) {
    chomp($ThisLine);
     # pobierz dzisiejsza date z 2002-03-31 22:13:48 ...
@@ -384,7 +388,7 @@
          # Link date and time (looks cleaner)...
          $aa = "$mdate $mtime";
          # Extract the REAL IP address...
-         ($bb) = ($ThisOne =~ m/\s\[(\d+\.\d+\.\d+\.\d+)\]\s/);
+         ($bb) = ($ThisOne =~ m/\s\[($IPAddress)\]\s/);
             # Exim >= 4.50 compiled with, WITH_CONTENT_SCAN=yes
          # Default warning looks like this...
             # rejected after DATA: This message contains a [vV]irus (%s).
@@ -442,19 +446,19 @@
          }
          elsif ( $ThisOne =~ m/contains attached ".(.*)" file, which is blacklisted/ ) {
             $cc = "Blocked Attachment";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /believed to be spam/ ) {
             $cc = "Blocked Fragmented Message";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /[Ww]arning: dnsbl\.sorbs\.net/ ) {
             $cc = "Blocked by DNSBL (SORBS)";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /fragments administratively prohibited/ ) {
             $cc = "Blocked Fragmented Message";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ m/unqualified sender rejected: <(.*)>/ ) {
             $cc = "Unqualified Sender";
@@ -466,7 +470,7 @@
          }
          elsif ( $ThisOne =~ m/not accept Windows executables/ ) {
             $cc = "Blocked Attachment";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ m/remote host address is the local host/ ) {
             $cc = "Invalid local domain";
@@ -519,39 +523,39 @@
 
          if ( $ThisOne =~ m/SMTP protocol violation\:\s(.*?\(.*?\))\:/ ) {
             $cc = $1;
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /unexpected disconnection while reading SMTP command/ ) {
             $cc = "Sudden disconnect while expecting remote input";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
-         elsif ( $ThisOne =~ m/rejected ([HE][EH])LO from \[(\d+\.\d+\.\d+\.\d+)\]\:\s(.*?):\s(.*?)$/ ) {
+         elsif ( $ThisOne =~ m/rejected ([HE][EH])LO from \[($IPAddress)\]\:\s(.*?):\s(.*?)$/ ) {
             $cc = "Rejected HELO/EHLO: $3";
             $bb = "$2 ($1LO $4)";
          }
          elsif ( $ThisOne =~ /SMTP data timeout \(message abandoned\) on connection from/ ) {
             $cc = "SMTP Timeout errors";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /SMTP command timeout on connection from/ ) {
             $cc = "SMTP Timeout errors";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /syntactically invalid argument/ ) {
             $cc = "SMTP Syntax errors";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /SMTP syntax error in/ ) {
             $cc = "SMTP Syntax errors";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /remote host used my name in HELO/ ) {
             $cc = "My name in HELO";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /remote host used IP address in HELO/ ) {
             $cc = "IP address in HELO";
-            ( $bb ) = ($ThisOne =~ m/\[(\d+\.\d+\.\d+\.\d+)\]/);
+            ( $bb ) = ($ThisOne =~ m/\[($IPAddress)\]/);
          }
          elsif ( $ThisOne =~ /incomplete transaction (\(.*\))/ ) {
             $bb = "SMTP transaction cut short $1";

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.