Bug 429933 - Logwatch does not escape regex metacharacters in postfix log processing
Logwatch does not escape regex metacharacters in postfix log processing
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: logwatch (Show other bugs)
rawhide
All Linux
low Severity low
: ---
: ---
Assigned To: Ivana Varekova
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-23 16:00 EST by Benjamin Gordon
Modified: 2008-01-28 06:30 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-28 06:30:16 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Benjamin Gordon 2008-01-23 16:00:10 EST
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 06:30:16 EST
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.