Package: postfix
Version: 2.1.5-8
Severity: normal
Tags: sid patch
The ppp and ifupdown hook scripts have some shortcomings which will
cause them to fail, e.g., if /usr/sbin/sendmail is not present or if
certain string variables are null. Also, the comment in the script is
inappropriate when the script is installed in if-up.d/. I attach a
patch (postfix.hook_jdth1.patch) that should fix these problems.
Here is /etc/ppp/ip-up.d/postfix a.k.a. /etc/network/if-up.d/postfix
after application of the patch:
-------------------------------------------------------------------
#!/bin/sh -e
# Written by LaMont Jones <[EMAIL PROTECTED]>
if [ ! -x /sbin/resolvconf ]; then
QDIR="$(postconf -h queue_directory)"
if [ "$QDIR" ]; then
cp --preserve=timestamps /etc/resolv.conf
"$QDIR"/etc/resolv.conf
/etc/init.d/postfix reload >/dev/null 2>&1
fi
fi
[ -x /usr/sbin/sendmail ] || exit 0
[ -f /var/spool/postfix/pid/master.pid ] || exit 0
pid="$(sed 's/ //g' /var/spool/postfix/pid/master.pid)"
[ -e "/proc/$pid/exe" ] || exit 0
exe="$(ls -l "/proc/$pid/exe" 2>/dev/null | sed 's/.* //')"
[ "$exe" = "/usr/lib/postfix/master" ] || exit 0
# Master is running, so force a queue run to unload any mail that is
# hanging around. Yes, sendmail is a symlink...
/usr/sbin/sendmail -q
-------------------------------------------------------------------
Here is /etc/ppp/ip-down.d/postfix a.k.a. /etc/network/if-down.d/postfix
after application of the patch:
-------------------------------------------------------------------
#!/bin/sh -e
# Written by LaMont Jones <[EMAIL PROTECTED]>
if [ ! -x /sbin/resolvconf ]; then
QDIR="$(postconf -h queue_directory)"
if [ "$QDIR" ]; then
cp --preserve=timestamps /etc/resolv.conf
"$QDIR"/etc/resolv.conf
/etc/init.d/postfix reload >/dev/null 2>&1
fi
fi
exit 0
-------------------------------------------------------------------
Additionally, I question whether the if-up.d hook script should run
sendmail when the loopback interface is configured. I append a second
patch to make it exit in the latter event. Here is
/etc/network/if-up.d/postfix after application of this second patch:
-------------------------------------------------------------------
#!/bin/sh -e
# Written by LaMont Jones <[EMAIL PROTECTED]>
if [ ! -x /sbin/resolvconf ]; then
QDIR="$(postconf -h queue_directory)"
if [ "$QDIR" ]; then
cp --preserve=timestamps /etc/resolv.conf
"$QDIR"/etc/resolv.conf
/etc/init.d/postfix reload >/dev/null 2>&1
fi
fi
[ "$METHOD" = "loopback" ] && exit 0
[ -x /usr/sbin/sendmail ] || exit 0
[ -f /var/spool/postfix/pid/master.pid ] || exit 0
pid="$(sed 's/ //g' /var/spool/postfix/pid/master.pid)"
[ -e "/proc/$pid/exe" ] || exit 0
exe="$(ls -l "/proc/$pid/exe" 2>/dev/null | sed 's/.* //')"
[ "$exe" = "/usr/lib/postfix/master" ] || exit 0
# Master is running, so force a queue run to unload any mail that is
# hanging around. Yes, sendmail is a symlink...
/usr/sbin/sendmail -q
-------------------------------------------------------------------
Here is the second patch:
--- /etc/network/if-up.d/postfix_PRE 2005-02-27 10:26:11.000000000 +0100
+++ /etc/network/if-up.d/postfix 2005-02-27 10:25:27.000000000 +0100
@@ -9,6 +9,7 @@
fi
fi
+[ "$METHOD" = "loopback" ] && exit 0
[ -x /usr/sbin/sendmail ] || exit 0
[ -f /var/spool/postfix/pid/master.pid ] || exit 0
pid="$(sed 's/ //g' /var/spool/postfix/pid/master.pid)"
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing'), (50, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.10
Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15)
Versions of packages postfix depends on:
ii adduser 3.59 Add and remove users and groups
ii debconf [debconf-2.0] 1.4.32 Debian configuration management sy
ii dpkg 1.10.27 Package maintenance system for Deb
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libdb4.2 4.2.52-18 Berkeley v4.2 Database Libraries [
ii libgdbm3 1.8.3-2 GNU dbm database routines (runtime
ii netbase 4.20 Basic TCP/IP networking system
-- debconf information excluded
--- /etc/ppp/ip-up.d/postfix_2.1.5-8 2005-02-27 06:13:02.000000000 +0100
+++ /etc/ppp/ip-up.d/postfix 2005-02-27 10:25:17.000000000 +0100
@@ -1,20 +1,22 @@
#!/bin/sh -e
-
-# Called when ppp connects
# Written by LaMont Jones <[EMAIL PROTECTED]>
-# start or reload Postfix as needed
if [ ! -x /sbin/resolvconf ]; then
- cp /etc/resolv.conf $(postconf -h queue_directory)/etc/resolv.conf
- /etc/init.d/postfix reload >/dev/null 2>&1
+ QDIR="$(postconf -h queue_directory)"
+ if [ "$QDIR" ]; then
+ cp --preserve=timestamps /etc/resolv.conf
"$QDIR"/etc/resolv.conf
+ /etc/init.d/postfix reload >/dev/null 2>&1
+ fi
fi
-# If master is running, force a queue run to unload any mail that is
+[ -x /usr/sbin/sendmail ] || exit 0
+[ -f /var/spool/postfix/pid/master.pid ] || exit 0
+pid="$(sed 's/ //g' /var/spool/postfix/pid/master.pid)"
+[ -e "/proc/$pid/exe" ] || exit 0
+exe="$(ls -l "/proc/$pid/exe" 2>/dev/null | sed 's/.* //')"
+[ "$exe" = "/usr/lib/postfix/master" ] || exit 0
+
+# Master is running, so force a queue run to unload any mail that is
# hanging around. Yes, sendmail is a symlink...
-if [ -f /var/spool/postfix/pid/master.pid ]; then
- pid=$(sed 's/ //g' /var/spool/postfix/pid/master.pid)
- exe=$(ls -l /proc/$pid/exe 2>/dev/null | sed 's/.* //')
- if [ $exe = "/usr/lib/postfix/master" ]; then
- /usr/sbin/sendmail -q
- fi
-fi
+/usr/sbin/sendmail -q
+
--- /etc/ppp/ip-down.d/postfix_2.1.5-8 2004-04-02 03:33:07.000000000 +0200
+++ /etc/ppp/ip-down.d/postfix 2005-02-27 10:17:08.000000000 +0100
@@ -1,12 +1,12 @@
#!/bin/sh -e
-
-# Called when ppp disconnects
# Written by LaMont Jones <[EMAIL PROTECTED]>
-# start or reload Postfix as needed
if [ ! -x /sbin/resolvconf ]; then
- cp /etc/resolv.conf $(postconf -h queue_directory)/etc/resolv.conf
- /etc/init.d/postfix reload >/dev/null 2>&1
+ QDIR="$(postconf -h queue_directory)"
+ if [ "$QDIR" ]; then
+ cp --preserve=timestamps /etc/resolv.conf
"$QDIR"/etc/resolv.conf
+ /etc/init.d/postfix reload >/dev/null 2>&1
+ fi
fi
exit 0