logwatch/logwatch-sendmail-id.patch

42 lines
1.5 KiB
Diff

From ddbd80b1efaa6e95536d0262985f13147208e775 Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Wed, 28 Mar 2018 15:43:12 +0100
Subject: [PATCH] Fix pattern for sendmail queue ID to parse ones with PID
having 7 digits.
Sendmail 8.15 uses the following format for queue id:
- 6 letters or digits dependent on date and time,
- 2 letters or digits dependent on random sequence ID,
- PID of sendmail process formatted by snprintf using "%06d" format.
Format "%06d" means that resulting string has *minimal* length of 6 characters,
padded with leading zeroes if necessary.
But if PID is greater than 999999, the resulting string can be longer,
up to 7 characters if kernel.pid_max sysctl parameter is big enough.
By default it's 32768, but can be up to 4194304 on 64-bit systems.
This change fixes logwatch to parse sendmail log lines produced by
sendmail processes that have 7-digit PID.
Signed-off-by: Oleg Girko <ol@infoserver.lv>
---
scripts/services/sendmail | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/services/sendmail b/scripts/services/sendmail
index d97e7a2..1acd733 100644
--- a/scripts/services/sendmail
+++ b/scripts/services/sendmail
@@ -387,7 +387,7 @@ for my $i (0..9) {
}
# QueueID formats: in 8.11 it was \w{7}\d{5}, in 8.12+ it is \w{8}\d{6}
-my $QueueIDFormat = "(?:\\w{7,9}\\d{5}|NOQUEUE)";
+my $QueueIDFormat = "(?:\\w{7,9}\\d{5,7}|NOQUEUE)";
# ENOENT refers to "no such file or directory"
my $ENOENT = Errno::ENOENT();
--
2.14.3