Package: sendmail-base
Version: 8.14.3-5+lenny1
Severity: important
Tags: patch


 Since we upgraded our MX servers to lenny, we are seeing spurious random
and unexplained delays in some mail deliveries (from a few minutes to
nearly a full day).
 We finally traced the problem to the /etc/cron.d/sendmail file that
handles queue aging.

With the following queue aging configuration in /etc/mail/sendmail.conf :

AGE_DATA="[\
['1h', '', 'hourly-in', 'in'],\
['1h', '', 'hourly-out', 'out'],\
['4h', '', 'daily-in', 'hourly-in'],\
['4h', '', 'daily-out', 'hourly-out'],\
]";

We get the following in /etc/cron.d/sendmail

# Every so often, give sendmail a chance to age the queues.
#
37   *    *    *    *           root    test -x /etc/init.d/sendmail && 
/usr/share/sendmail/qtool.pl -s 0 /var/spool/mqueue/hourly-in 
/var/spool/mqueue/in >/dev/null
26   *    *    *    *           root    test -x /etc/init.d/sendmail && 
/usr/share/sendmail/qtool.pl -s 0 /var/spool/mqueue/hourly-out 
/var/spool/mqueue/out >/dev/null
01   */04 *    *    *           root    test -x /etc/init.d/sendmail && 
/usr/share/sendmail/qtool.pl -s 0 /var/spool/mqueue/daily-in 
/var/spool/mqueue/hourly-in >/dev/null
15   */04 *    *    *           root    test -x /etc/init.d/sendmail && 
/usr/share/sendmail/qtool.pl -s 0 /var/spool/mqueue/daily-out 
/var/spool/mqueue/hourly-out >/dev/null

Notice the '-s 0' on all lines when the first two should have -s 3600 and the
last two -s 14400. The consequence is that all mails in the queues are
aged when qtools.pl runs, causing the observed delays.

This problems seems to result from a computation bug in the sm2cron_time()
function in the perl script /usr/share/sendmail/update_conf
This function returns a number of seconds in the variable $seconds but
this same variable is altered several times and ends up containing a
number of seconds modulo 60.
I propose the following patch, which stores the initial value of $seconds
in $allseconds and returns $allseconds in the end.

/usr/share/sendmail$ diff -u update_conf.bad update_conf
--- update_conf.bad     2010-01-29 15:03:10.000000000 +0100
+++ update_conf 2010-05-25 11:42:53.000000000 +0200
@@ -186,12 +186,13 @@
 
        my ($sm)        = @_;
        my $seconds = 0;
+       my $allseconds = 0;
        my $randstart = '00';
        if ($sm eq '') {
                if ( $main::opt_test ) {
                        print "mm   hh  dom  mon dow = sm2cron_time($sm);\n";
                        };
-               return ($cron, $seconds);
+               return ($cron, $allseconds);
                };
 
        # Convert sendmail time
@@ -214,6 +215,7 @@
                 + ($hour   * 60 * 60)
                 + ($minute * 60)
                 + $second;
+       $allseconds = $seconds;
        $month   = $seconds / (4 * 7 * 24 * 60 * 60);
        $seconds = $seconds % (4 * 7 * 24 * 60 * 60);
        $week    = $seconds / (7 * 24 * 60 * 60);
@@ -293,7 +295,7 @@
        if ( $main::opt_test ) {
                print "$cron = sm2cron_time($sm);\n";
                };
-       return ($cron, $seconds);       
+       return ($cron, $allseconds);    
        };
 
 #

-- System Information:
Debian Release: 5.0.4
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.32.9
Locale: lang=fr...@euro, lc_ctype=fr...@euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages sendmail-base depends on:
ii  adduser                  3.110           add and remove users and groups
ii  m4                       1.4.11-1        a macro processing language
ii  make                     3.81-5          The GNU version of the "make" util
ii  perl                     5.10.0-19lenny2 Larry Wall's Practical Extraction 

sendmail-base recommends no packages.

Versions of packages sendmail-base suggests:
ii  ca-certificates               20080809   Common CA certificates
pn  logcheck                      <none>     (no description available)
ii  logrotate                     3.7.1-5    Log rotation utility
pn  resolvconf                    <none>     (no description available)
pn  sendmail-doc                  <none>     (no description available)



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to