Package: postfix
Version: 3.1.3-6
Severity: normal

Dear Maintainer,

The scripts under debian/ use `postconf -h` to obtain configuration
settings.  Some (but not all) of those instances should pass -x to
postconf(1), in case the administrator used the postconf(5)
interpolation feature.

The attached unidiff enumerates the instances that I believe need
changing.  This list is based on code review only.

I removed the function get_postconf() as it is unused.

Cheers,

Daniel

diff --git a/debian/configure-instance.sh b/debian/configure-instance.sh
index d6a1792..6875eb3 100644
--- a/debian/configure-instance.sh
+++ b/debian/configure-instance.sh
@@ -25,7 +25,7 @@ fi
 # if you set myorigin to 'ubuntu.com' or 'debian.org', it's wrong, and annoys 
the admins of
 # those domains.  See also sender_canonical_maps.
 
-MYORIGIN=$($POSTCONF -h myorigin | tr 'A-Z' 'a-z')
+MYORIGIN=$($POSTCONF -hx myorigin | tr 'A-Z' 'a-z')
 if [ "X${MYORIGIN#/}" != "X${MYORIGIN}" ]; then
        MYORIGIN=$(tr 'A-Z' 'a-z' < $MYORIGIN)
 fi
@@ -41,11 +41,11 @@ NEED_CHROOT=$(awk '/^[0-9a-z]/ && ($5 ~ "[-yY]") { print 
"y"; exit}' ${config_di
 if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
        # Make sure that the chroot environment is set up correctly.
        umask 022
-       queue_dir=$($POSTCONF -h queue_directory)
+       queue_dir=$($POSTCONF -hx queue_directory)
        cd "$queue_dir"
 
        # copy the CA path if specified
-       ca_path=$($POSTCONF -h smtp_tls_CApath)
+       ca_path=$($POSTCONF -hx smtp_tls_CApath)
        case "$ca_path" in
            '') :;; # no ca_path
            $queue_dir/*) :;;  # skip stuff already in chroot
@@ -77,7 +77,7 @@ if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
        esac
 
        # if there is a CA file, copy it
-       ca_file=$($POSTCONF -h smtp_tls_CAfile)
+       ca_file=$($POSTCONF -hx smtp_tls_CAfile)
        case "$ca_file" in
            $queue_dir/*) :;;  # skip stuff already in chroot
            '') # no ca_file
@@ -105,7 +105,7 @@ if [ -n "$NEED_CHROOT" ] && [ -n "$SYNC_CHROOT" ]; then
        esac
 
        # if we're using unix:passwd.byname, then we need to add etc/passwd.
-       local_maps=$($POSTCONF -h local_recipient_maps)
+       local_maps=$($POSTCONF -hx local_recipient_maps)
        if [ "X$local_maps" != "X${local_maps#*unix:passwd.byname}" ]; then
            if [ "X$local_maps" = "X${local_maps#*proxy:unix:passwd.byname}" ]; 
then
                sed 's/^\([^:]*\):[^:]*/\1:x/' /etc/passwd > etc/passwd
diff --git a/debian/init.d b/debian/init.d
index 8273f4b..d783085 100644
--- a/debian/init.d
+++ b/debian/init.d
@@ -40,8 +40,8 @@ running() {
            POSTCONF="postmulti -i $INSTANCE -x postconf"
     fi
 
-    queue=$($POSTCONF -h queue_directory 2>/dev/null || echo 
/var/spool/postfix)
-    daemondir=$($POSTCONF -h daemon_directory 2>/dev/null || echo 
/usr/lib/postfix/sbin)
+    queue=$($POSTCONF -hx queue_directory 2>/dev/null || echo 
/var/spool/postfix)
+    daemondir=$($POSTCONF -hx daemon_directory 2>/dev/null || echo 
/usr/lib/postfix/sbin)
     if [ -f ${queue}/pid/master.pid ]; then
        pid=$(sed 's/ //g' ${queue}/pid/master.pid)
        # what directory does the executable live in.  stupid prelink systems.
diff --git a/debian/ip-down.d b/debian/ip-down.d
index 07913aa..4101554 100644
--- a/debian/ip-down.d
+++ b/debian/ip-down.d
@@ -23,7 +23,7 @@ fi
 
 if [ ! -x /sbin/resolvconf ]; then
        f=/etc/resolv.conf
-       if ! cp $f $(postconf -h queue_directory)$f 2>/dev/null; then
+       if ! cp $f $(postconf -hx queue_directory)$f 2>/dev/null; then
                exit 0
        fi
        if [ -n "$RUNNING" ]; then
diff --git a/debian/ip-up.d b/debian/ip-up.d
index f91f518..f1203ff 100644
--- a/debian/ip-up.d
+++ b/debian/ip-up.d
@@ -26,7 +26,7 @@ fi
 # start or reload Postfix as needed
 if [ ! -x /sbin/resolvconf ]; then
        f=/etc/resolv.conf
-       if ! cp $f $(postconf -h queue_directory)$f 2>/dev/null; then
+       if ! cp $f $(postconf -hx queue_directory)$f 2>/dev/null; then
                exit 0
        fi
        if [ -n "$RUNNING" ]; then
diff --git a/debian/postfix.postinst b/debian/postfix.postinst
index ce54e87..808a1a1 100644
--- a/debian/postfix.postinst
+++ b/debian/postfix.postinst
@@ -78,10 +78,6 @@ set_postconf() {
     postconf -e "$@"
 }
 
-get_postconf() {
-    postconf -h "$@"
-}
-
 makedir() {
     if [ ! -d $1 ]; then
        mkdir $1
@@ -321,7 +317,7 @@ if [ "$mailer" != "No configuration" ]; then        # [
     # Fix master.cf for compat changes in 3.0.  See Debian bug #816172
     # Also fix myhostname if needed.
     if `dpkg --compare-versions "$2" lt 3.1.0-1~`; then
-       for dir in /etc/postfix $(postconf -hn multi_instance_directories); do
+       for dir in /etc/postfix $(postconf -hxn multi_instance_directories); do
            hname=$(postconf -h -c "$dir" myhostname)
             if [ "${hname}" = "${hname%.*}" ]; then
                echo "setting myhostname=$myhostname in ${dir}"
@@ -495,7 +491,7 @@ EOF
     # Handle migrating daemon_directory, if present, and coming from before
     # 3.0.4-5
     if [ -n "$OLDVERSION" ] && dpkg --compare-versions $OLDVERSION lt 3.0.4-5; 
then
-       for dir in /etc/postfix $(postconf -hn multi_instance_directories); do
+       for dir in /etc/postfix $(postconf -hxn multi_instance_directories); do
            DD=$(postconf -c "$dir" -hn daemon_directory)
            if [ "X${DD}" = X/usr/lib/postfix ]; then
                # The install was aborted in preinst if we didn't get
@@ -612,9 +608,9 @@ if [ "$mailer" != "No configuration" ] || [ -f 
/etc/postfix/main.cf ]; then
        echo "Running newaliases"
        rm -f /etc/aliases.db   # handle the roll to db2.0
        # newaliases chokes if hostname not set
-       # newaliases is equivalent to postalias $(postconf -h alias_database)
+       # newaliases is equivalent to postalias $(postconf -hx alias_database)
        # and in debootstrap, newaliases == /bin/true...
-       if [ -z "$(postconf -h myhostname||true)" ]; then
+       if [ -z "$(postconf -hx myhostname||true)" ]; then
           cp -a main.cf main.cf.dpkg.$$
           postconf -e 'myhostname=debian'
           newaliases
diff --git a/debian/postfix.preinst b/debian/postfix.preinst
index 318d1e8..b923c94 100644
--- a/debian/postfix.preinst
+++ b/debian/postfix.preinst
@@ -255,7 +255,7 @@ case "$1" in
        if dpkg --compare-versions $version lt 3.1.0-1; then
            # check on compatibility warning issues and warn as appropriate.
            # even default myhostname needs to be checked to make sure it has a 
'.'.
-           for dir in /etc/postfix $(postconf -hn multi_instance_directories 
2>/dev/null || true); do
+           for dir in /etc/postfix $(postconf -hxn multi_instance_directories 
2>/dev/null || true); do
                if [ ! -f "${dir}/main.cf" ] || dpkg --compare-versions 
$version lt 2.11; then
                    # Just assume that there are issues with the chroot status,
                    # since postconf -F didn't exist before 2.11
@@ -273,7 +273,7 @@ case "$1" in
        if [ -f /etc/postfix/main.cf ] && dpkg --compare-versions $version lt 
3.0.4-5; then
            # if daemon_directory is specifically set, and wrong, then we need
             # to fix it.
-           for dir in /etc/postfix $(postconf -hn multi_instance_directories); 
do
+           for dir in /etc/postfix $(postconf -hxn 
multi_instance_directories); do
                DD=$(postconf -c "$dir" -hn daemon_directory)
                if [ "X${DD}" = X/usr/lib/postfix ]; then
                    main_cf_conversion_warning
diff --git a/debian/postfix_groups.pl b/debian/postfix_groups.pl
index e21caa0..01536f7 100644
--- a/debian/postfix_groups.pl
+++ b/debian/postfix_groups.pl
@@ -147,7 +147,7 @@ my $removeheader_attr = 'mgrpRemoveHeader';
 
 my $smtp_host = 'localhost'; # Use smtpd running on localhost
 my $smtpd_recipient_limit = $postconf{smtpd_recipient_limit}
-                                                       || `postconf -h 
smtpd_recipient_limit`
+                                                       || `postconf -hx 
smtpd_recipient_limit`
                                                        || 1000;
 chomp $smtpd_recipient_limit;
 
diff --git a/debian/update-libc.d b/debian/update-libc.d
index 80b8f1f..1db67d2 100644
--- a/debian/update-libc.d
+++ b/debian/update-libc.d
@@ -4,7 +4,7 @@
 # if it's not running, it'll get picked up by the init script on start.
 /usr/sbin/service postfix status >/dev/null 2>&1 || exit 0
 
-QUEUEDIR="$(/usr/sbin/postconf -h queue_directory 2>/dev/null || true)"
+QUEUEDIR="$(/usr/sbin/postconf -hx queue_directory 2>/dev/null || true)"
 if [ -n "$QUEUEDIR" ]; then
     cp /etc/resolv.conf ${QUEUEDIR}/etc/resolv.conf
     /usr/sbin/service postfix reload >/dev/null 2>&1 || exit 0

Reply via email to