Bug 429933 - Logwatch does not escape regex metacharacters in postfix log processing
Summary: Logwatch does not escape regex metacharacters in postfix log processing
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: logwatch
Version: rawhide
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Ivana Varekova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-23 21:00 UTC by Benjamin Gordon
Modified: 2008-01-28 11:30 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-28 11:30:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Benjamin Gordon 2008-01-23 21:00:10 UTC
Description of problem:

When processing the postfix log, logwatch embeds part of a log line into a regex without escaping 
metacharacters.  If the previously matched email address contains special characters like [, *, ?, etc, this 
can cause it to fail to process the log.

Version-Release number of selected component (if applicable):

logwatch-7.3.6-17.noarch

How reproducible:

Always

Steps to Reproduce:
1. Get a line into /var/log/maillog that contains e.g. to=<*@wanadoo.fr>
2. Run logwatch
3.
  
Actual results:

Postfix section of output is replaced with an error message.

Expected results:

Line is correctly processed along with others.

Additional info:

This patch takes care of the problem, or at least the part that my particular log files were triggering:

--- scripts/services/postfix.orig	2008-01-23 13:48:17.000000000 -0700
+++ scripts/services/postfix	2008-01-23 13:19:48.000000000 -0700
@@ -2163,7 +2163,7 @@
    #print "HOSTREPLY: \"$hostreply\"\n";
    if (($host,$r1) = ($hostreply =~ /host (\S+) said: $re_DSN[\- ]"?(.*)"?$/o)) {
       # Strip recipient address from host's reply - we already have it in $recip.
-      $r1 =~ s/[<(]?$recip[>)]?\W*//ig;
+      $r1 =~ s/[<(]?\Q$recip\E[>)]?\W*//ig;
 
       # Strip and capture "in reply to XYZ command" from host's reply
       if ($r1 =~ s/\s*[(]?(in reply to .* command)[)]?//) {

Comment 1 Ivana Varekova 2008-01-28 11:30:16 UTC
Thanks - fixed in logwatch-7.3.6-18.fc9.


Note You need to log in before you can comment on or make changes to this bug.