Bug#340002: exim4-base: cron job incorreectly uses hardcoded spool directory

Marc Haber mh+debian-packages at zugschlus.de
Sun Nov 20 10:26:26 UTC 2005


tags #340002 confirmed
thanks

On Sun, Nov 20, 2005 at 10:14:06AM +0100, Alex Hermann wrote:
> The file /etc/cron.daily/exim4-base ahrdcodes the spool directory 
> as /var/spool/exim4. However, the spool directory is configurable
> in the configuration file (directive: spool_directory or SPOOLDIR).
> I think the cron-job should use the directory specified in the 
> configuration file(s).

What do you think about the attached patch?

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 621 72739835
-------------- next part --------------
Index: debian/exim4_refresh_gnutls-params
===================================================================
--- debian/exim4_refresh_gnutls-params	(revision 1281)
+++ debian/exim4_refresh_gnutls-params	(working copy)
@@ -10,19 +10,20 @@
   exit 1
 fi
 
-cd /var/spool/exim4/
+SPOOLDIR="$(exim4 -bP spool_directory | sed 's/.*=[[:space:]]\(.*\)/\1/')"
+cd $SPOOLDIR
 
-tempgnutls=`tempfile -d /var/spool/exim4/`
+tempgnutls=$(tempfile -d $SPOOLDIR)
 if /usr/share/exim4/timeout.pl \
   "$1" /usr/bin/certtool --generate-privkey --bits 512 \
   > "$tempgnutls" 2> /dev/null && \
   /usr/share/exim4/timeout.pl \
   "$1" /usr/bin/certtool --generate-dh-params --bits 1024 \
   >> "$tempgnutls" 2> /dev/null ; then
-  if [ -e /var/spool/exim4/gnutls-params ] ; then
-    chmod --reference=/var/spool/exim4/gnutls-params "$tempgnutls"
+  if [ -e $SPOOLDIR/gnutls-params ] ; then
+    chmod --reference=$SPOOLDIR/gnutls-params "$tempgnutls"
   fi
-  mv -f "$tempgnutls" /var/spool/exim4/gnutls-params
+  mv -f "$tempgnutls" $SPOOLDIR/gnutls-params
 else
   rm -f "$tempgnutls"
 fi
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 1281)
+++ debian/changelog	(working copy)
@@ -6,8 +6,11 @@
     seleted. Thanks to Ted Percival. (mh) Closes: #337229
   * A number of man page fixes. Thanks to A Costa. (mh)
     Closes: #338580, #338581, #338582, #338583, #338584
+  * Pull spool dir path from exim -bP instead of hard-coding it in
+    daily cron job and exim4_refresh_gnutls-params.
+    Thanks to Alex Hermann. (mh) Closes: 340002
 
- -- Marc Haber <mh+debian-packages at zugschlus.de>  Mon, 14 Nov 2005 14:30:21 +0100
+ -- Marc Haber <mh+debian-packages at zugschlus.de>  Sun, 20 Nov 2005 11:23:35 +0100
 
 exim4 (4.54-2) unstable; urgency=low
 
Index: debian/exim4-base.cron.daily
===================================================================
--- debian/exim4-base.cron.daily	(revision 1281)
+++ debian/exim4-base.cron.daily	(working copy)
@@ -10,6 +10,7 @@
   exit 0
 fi
 
+SPOOLDIR="$(exim -bP spool_directory | sed 's/.*=[[:space:]]\(.*\)/\1/')"
 # Uncomment the following lines to get daily e-mail reports
 #if [ -x /usr/sbin/eximstats ]; then
 #  eximstats </var/log/exim4/mainlog \
@@ -19,24 +20,24 @@
 
 # run tidydb as Debian-exim:Debian-exim.
 if [ -x /usr/sbin/exim_tidydb ]; then
-  cd /var/spool/exim4/db || exit 1
-  find /var/spool/exim4/db -maxdepth 1 -name '*.lockfile' -or -type f \
+  cd $SPOOLDIR/db || exit 1
+  find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -type f \
     -printf '%f\0' | \
       xargs -0r -n 1 \
       start-stop-daemon --start --exec /usr/sbin/exim_tidydb \
-      --chuid Debian-exim:Debian-exim -- /var/spool/exim4 > /dev/null
+      --chuid Debian-exim:Debian-exim -- $SPOOLDIR > /dev/null
 fi
 
-# regenerate /var/spool/exim4/gnutls-params
+# regenerate $SPOOLDIR/gnutls-params
 # As this can take _very_ long on machines with little entropy, we limit
 # the maximum runtime to 2*$CERTTOOLTIMEOUT seconds and keep using the
 # old file otherwise.
 CERTTOOLTIMEOUT=1800
-if [ -e /var/spool/exim4/gnutls-params ] ; then
+if [ -e $SPOOLDIR/gnutls-params ] ; then
   if [ -x /usr/bin/certtool ] ; then
     start-stop-daemon --start --exec /usr/share/exim4/exim4_refresh_gnutls-params \
       --chuid Debian-exim:Debian-exim -- ${CERTTOOLTIMEOUT}
   else
-    rm -f /var/spool/exim4/gnutls-params
+    rm -f $SPOOLDIR/gnutls-params
   fi
 fi


More information about the Pkg-exim4-maintainers mailing list