SF.net SVN: logwatch:[282] branches/beta-7-4-2/scripts/services/sendmail

[email protected] Wed, 24 Dec 2014 18:09:14 +0000
Newsgroups gmane.comp.log.logwatch.devel
Message-ID <[email protected]>
Revision: 282
          http://sourceforge.net/p/logwatch/code/282
Author:   bjorn1
Date:     2014-12-24 18:09:14 +0000 (Wed, 24 Dec 2014)
Log Message:
-----------
fixed matching of unrecognized commands to unmatched entries

Modified Paths:
--------------
    branches/beta-7-4-2/scripts/services/sendmail

Modified: branches/beta-7-4-2/scripts/services/sendmail
===================================================================
--- branches/beta-7-4-2/scripts/services/sendmail	2014-12-24 16:21:34 UTC (rev 281)
+++ branches/beta-7-4-2/scripts/services/sendmail	2014-12-24 18:09:14 UTC (rev 282)
@@ -876,7 +876,7 @@
    } elsif ( ($Temp) = ($ThisLine=~ /\-\-\- 500 5\.5\.1 Command unrecognized: \"(.*)\"/) ) {
       # first we try to delete it from the list of Unmatched Entries
       $Temp1 = "<-- " . $Temp;
-      if ($OtherList{$Temp1} > 0) {
+      if (defined $OtherList{$Temp1}) {
          if ($OtherList{$Temp1} == 1) {
             delete ($OtherList{$Temp1});
          } else {
@@ -1162,9 +1162,17 @@
       chomp($ThisLine);
       # Report any unmatched entries...
       if ($ThisLine =~ /^<-- /) {
-         # sendmail converts non-ascii chars (remove high bit), so we do
-         # the same
-         $ThisLine =~ s/\\([23]\d{2})/chr(oct($1-200))/eg;
+         # sendmail converts some characters, so we do the same
+         $ThisLine =~ s/\\([23]\d{2})/
+            # clear the most significant bit if set
+            my $tempchar = oct($1 - 200);
+            # if the new value is a printable ASCII character, print it
+            if (($tempchar >= 32) && ($tempchar != 127)) {
+               chr($tempchar);
+            } else {
+            # if not printable ASCII, leave as octal code
+               sprintf("\\%o", $tempchar);
+            }/eg;
       }
       # store last unmatched entry, in case it is needed later.  But note that some
       # statements have no QueueID.

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


------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net