Package: mailgraph
Version: 1.14-10
Severity: normal
Tags: patch

Hi Julien,

when the Postfix configuration parameter enable_long_queue_ids is set to
`yes', mailgraph is unable to count received mails.

With the attached patch mailgraph is able to count incoming messages again.
No matter if Postfix uses long or short queue IDs.


Regards,
Pascal

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing'), (50, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages mailgraph depends on:
ii  debconf [debconf-2.0]  1.5.43
ii  libfile-tail-perl      0.99.3-5
ii  librrds-perl           1.4.7-1
ii  perl                   5.14.2-11
ii  ucf                    3.0025+nmu3

Versions of packages mailgraph recommends:
ii  apache2                         2.2.22-6
ii  apache2-mpm-worker [httpd]      2.2.22-6
ii  postfix [mail-transport-agent]  2.9.3-2

mailgraph suggests no packages.

-- Configuration Files:
/etc/default/mailgraph changed:
BOOT_START="true"
MAIL_LOG="/var/log/mail.log"
IGNORE_LOCALHOST="true"
EXTRA_OPTIONS="--rbl-is-spam"
HTTP_USER="www-data"
HTTP_GROUP="www-data"


-- debconf information:
* mailgraph/ignore_localhost: true
* mailgraph/mail_log: /var/log/mail.log
* mailgraph/start_on_boot: true
Description: Add Postfix long, non-repeating, queue ID support.
 The long queue IDs are encoded in a 52-character alphabet that contains:
    - digits (0-9)
    - upper-case letters (B-Z) w/o AEIOU
    - lower-case letters (b-z) w/o aeiou

 Additionally it corrects the regular expression for the short queue IDs.
 The short queue IDs are encoded in hexadecimal alphabet that contains:
    - digits (0-9)
    - upper-case letters (A-F)
Author: Pascal Volk <u...@localhost.localdomain.org>

--- a/mailgraph.pl
+++ b/mailgraph.pl
@@ -620,7 +620,7 @@
 			}
 		}
 		elsif($prog eq 'smtpd') {
-			if($text =~ /^[0-9A-Z]+: client=(\S+)/) {
+			if($text =~ /^(?:[\dA-F]+|[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+): client=(\S+)/) {
 				my $client = $1;
 				return if $opt{'ignore-localhost'} and
 					$client =~ /\[127\.0\.0\.1\]$/;
@@ -628,19 +628,19 @@
 					$client =~ /$opt{'ignore-host'}/oi;
 				event($time, 'received');
 			}
-			elsif($opt{'virbl-is-virus'} and $text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 554.* blocked using virbl.dnsbl.bit.nl/) {
+			elsif($opt{'virbl-is-virus'} and $text =~ /^(?:[\dA-F]+: |[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+: |NOQUEUE: )?reject: .*: 554.* blocked using virbl.dnsbl.bit.nl/) {
 				event($time, 'virus');
 			}
-			elsif($opt{'rbl-is-spam'} and $text    =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: .*: 554.* blocked using/) {
+			elsif($opt{'rbl-is-spam'} and $text    =~ /^(?:[\dA-F]+: |[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+: |NOQUEUE: )?reject: .*: 554.* blocked using/) {
 				event($time, 'spam');
 			}
 			elsif($text =~ /Greylisted/) {
 				event($time, 'greylisted');
 			}
-			elsif($text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?reject: /) {
+			elsif($text =~ /^(?:[\dA-F]+: |[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+: |NOQUEUE: )?reject: /) {
 				event($time, 'rejected');
 			}
-			elsif($text =~ /^(?:[0-9A-Z]+: |NOQUEUE: )?milter-reject: /) {
+			elsif($text =~ /^(?:[\dA-F]+: |[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+: |NOQUEUE: )?milter-reject: /) {
 				if($text =~ /Blocked by SpamAssassin/) {
 					event($time, 'spam');
 				}
@@ -655,7 +655,7 @@
 			}
 		}
 		elsif($prog eq 'cleanup') {
-			if($text =~ /^[0-9A-Z]+: (?:reject|discard): /) {
+			if($text =~ /(?:[\dA-F]+|[\dB-DF-HJ-NP-TV-Zb-df-hj-np-tv-z]+): (?:reject|discard): /) {
 				event($time, 'rejected');
 			}
 		}

Reply via email to