tags 295306 patch
thanks

Hi Jonas,

This RC bug has been open for a long time now, and there has been no
activity on it for three weeks.  I have prepared an NMU with the attached
patch, based on the one prepared by Adeodato and Pierre but without the
intrusive (and currently broken) template-based maintainer scripts.  I will
be uploading this to unstable shortly according to the 0-day NMU policy.

Thanks,
-- 
Steve Langasek
postmodern programmer
diff -u uw-imap-2002edebian1/debian/changelog 
uw-imap-2002edebian1/debian/changelog
--- uw-imap-2002edebian1/debian/changelog
+++ uw-imap-2002edebian1/debian/changelog
@@ -1,3 +1,14 @@
+uw-imap (7:2002edebian1-6.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * High-urgency upload for sarge-targetted RC bugfix
+  * Handle inetd.conf correctly on upgrades, to not lose local
+    configuration changes; thanks to Pierre Habouzit
+    <[EMAIL PROTECTED]> and Adeodato Simó <[EMAIL PROTECTED]> for
+    their work on this fix (closes: #295306).
+
+ -- Steve Langasek <[EMAIL PROTECTED]>  Mon, 21 Mar 2005 04:59:48 -0800
+
 uw-imap (7:2002edebian1-6) unstable; urgency=high
 
   * Fix CERT security bug VU#702777: CRAM-MD5 authentication (disabled
diff -u uw-imap-2002edebian1/debian/ipopd.postrm 
uw-imap-2002edebian1/debian/ipopd.postrm
--- uw-imap-2002edebian1/debian/ipopd.postrm
+++ uw-imap-2002edebian1/debian/ipopd.postrm
@@ -9,15 +9,21 @@
 ##
 ## Remove POP daemons from inetd.conf
 ##
+
+if [ "$1" = "purge" ]; then
+    UPDATE_INETD_ARG='--remove'
+else
+    # Note that we disable in upgrades too
+    UPDATE_INETD_ARG='--disable'
+fi
+
 db_get ipopd/protocol
 for i in `echo "$RET" | sed 's/,/ /g'`; do
-       if [ "$i" = "pop2" ]; then
-               update-inetd --remove pop2;
-       elif [ "$i" = "pop3" ]; then
-               update-inetd --remove pop3;
-       elif [ "$i" = "pop3s" ]; then
-               update-inetd --remove pop3s;
-       fi
+    case "$i" in
+       pop2|pop3|pop3s)
+           update-inetd $UPDATE_INETD_ARG $i
+           ;;
+    esac
 done
 
 if [ "$1" = "purge" -a -f /etc/ssl/certs/ipop3d.pem ]; then
diff -u uw-imap-2002edebian1/debian/ipopd.postinst 
uw-imap-2002edebian1/debian/ipopd.postinst
--- uw-imap-2002edebian1/debian/ipopd.postinst
+++ uw-imap-2002edebian1/debian/ipopd.postinst
@@ -2,21 +2,48 @@
 
 set -e
 
+PROGRAM=ipopd
+
 # Source debconf library.
 . /usr/share/debconf/confmodule
 db_version 2.0
 
-db_get ipopd/protocol
-for i in `echo "$RET" | sed 's/,/ /g'`; do
+if [ "$1" = "configure" ]; then
+    if [ -z "$2" ]; then
+       UPDATE_INETD_ARG='--group mail --add'
+       UPDATE_INETD_ARG_EXTRA="        stream  tcp     nowait  root    
/usr/sbin/tcpd"
+    else
+       UPDATE_INETD_ARG='--enable'
+
+       # Bug#295306
+       if dpkg --compare-versions "$2" le 7:2002edebian1-6
+       then
+           MY_FILE=/var/cache/${PROGRAM}_inetd.conf_copy
+           if [ -r "$MY_FILE" ]; then
+                while read line; do
+                    update-inetd --group mail --add "$line"
+                done < "$MY_FILE"
+                rm -f "$MY_FILE"
+           else
+               # The file has disappeared, or we're installing from
+               # 'config files' state. Install default entries.
+               UPDATE_INETD_ARG='--group mail --add'
+               UPDATE_INETD_ARG_EXTRA="        stream  tcp     nowait  root    
/usr/sbin/tcpd"
+           fi
+       fi
+    fi
 
+    db_get ipopd/protocol
+    for i in `echo "$RET" | sed 's/,/ /g'`; do
        if [ "$i" = "pop2" ]; then
-               update-inetd --group mail --add "pop2   stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/ipop2d"
+               update-inetd $UPDATE_INETD_ARG "pop2${UPDATE_INETD_ARG_EXTRA} 
/usr/sbin/ipop2d"
        elif [ "$i" = "pop3" ]; then
-               update-inetd --group mail --add "pop3   stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/ipop3d"
+               update-inetd $UPDATE_INETD_ARG "pop3${UPDATE_INETD_ARG_EXTRA} 
/usr/sbin/ipop3d"
        elif [ "$i" = "pop3s" ]; then
-               update-inetd --group mail --add "pop3s  stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/ipop3d"
+               update-inetd $UPDATE_INETD_ARG "pop3s${UPDATE_INETD_ARG_EXTRA} 
/usr/sbin/ipop3d"
        fi
-done
+    done
+fi
 
 cd /etc/ssl/certs
 PATH=$PATH:/usr/bin/ssl
@@ -41,7 +68,7 @@
        chown root.root /etc/ssl/certs/ipop3d.pem
        chmod 0640 /etc/ssl/certs/ipop3d.pem
 fi
-
+ 
 #DEBHELPER#
 
 exit 0
diff -u uw-imap-2002edebian1/debian/uw-imapd.postinst 
uw-imap-2002edebian1/debian/uw-imapd.postinst
--- uw-imap-2002edebian1/debian/uw-imapd.postinst
+++ uw-imap-2002edebian1/debian/uw-imapd.postinst
@@ -2,20 +2,46 @@
 
 set -e
 
+PROGRAM=uw-imapd
+
 # Source debconf library.
 . /usr/share/debconf/confmodule
 db_version 2.0
 
-db_get uw-imapd/protocol
-for i in `echo "$RET" | sed 's/,/ /g'`; do
-       if [ "$i" = "imap2" ]; then
-               update-inetd --group mail --add "imap2  stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/imapd";
-       elif [ "$i" = "imap3" ]; then
-               update-inetd --group mail --add "imap3  stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/imapd";
-       elif [ "$i" = "imaps" ]; then
-               update-inetd --group mail --add "imaps  stream  tcp     nowait  
root    /usr/sbin/tcpd /usr/sbin/imapd";
+if [ "$1" = "configure" ]; then
+    if [ -z "$2" ]; then
+       UPDATE_INETD_ARG='--group mail --add'
+       UPDATE_INETD_ARG_EXTRA="        stream  tcp     nowait  root    
/usr/sbin/tcpd /usr/sbin/imapd"
+    else
+       UPDATE_INETD_ARG='--enable'
+
+       # Bug#295306
+       if dpkg --compare-versions "$2" le 7:2002edebian1-6
+       then
+           MY_FILE=/var/cache/${PROGRAM}_inetd.conf_copy
+           if [ -r "$MY_FILE" ]; then
+                while read line; do
+                    update-inetd --group mail --add "$line"
+                done < "$MY_FILE"
+                rm -f "$MY_FILE"
+           else
+               # The file has disappeared, or we're installing from
+               # 'config files' state. Install default entries.
+               UPDATE_INETD_ARG='--group mail --add'
+               UPDATE_INETD_ARG_EXTRA="        stream  tcp     nowait  root    
/usr/sbin/tcpd /usr/sbin/imapd"
+           fi
        fi
-done
+    fi
+
+    db_get uw-imapd/protocol
+    for i in `echo "$RET" | sed 's/,/ /g'`; do
+       case "$i" in
+           imap2|imap3|imaps)
+               update-inetd $UPDATE_INETD_ARG "${i}${UPDATE_INETD_ARG_EXTRA}"
+               ;;
+       esac
+    done
+fi
 
 cd /etc/ssl/certs
 PATH=$PATH:/usr/bin/ssl
diff -u uw-imap-2002edebian1/debian/uw-imapd.postrm 
uw-imap-2002edebian1/debian/uw-imapd.postrm
--- uw-imap-2002edebian1/debian/uw-imapd.postrm
+++ uw-imap-2002edebian1/debian/uw-imapd.postrm
@@ -10,15 +10,20 @@
 ## Remove imapd from inetd.conf
 ##
 
+if [ "$1" = "purge" ]; then
+    UPDATE_INETD_ARG='--remove'
+else
+    # Note that we disable in upgrades too
+    UPDATE_INETD_ARG='--disable'
+fi
+
 db_get uw-imapd/protocol
 for i in `echo "$RET" | sed 's/,/ /g'`; do
-       if [ "$i" = "imap2" ]; then
-               update-inetd --remove imap2;
-       elif [ "$i" = "imap3" ]; then
-               update-inetd --remove imap3;
-       elif [ "$i" = "imaps" ]; then
-               update-inetd --remove imaps;
-       fi
+    case "$i" in
+       imap2|imap3|imaps)
+           update-inetd $UPDATE_INETD_ARG $i
+           ;;
+    esac
 done
 
 if [ "$1" = "purge" -a -f /etc/ssl/certs/imapd.pem ]; then
only in patch2:
unchanged:
--- uw-imap-2002edebian1.orig/debian/uw-imapd.preinst
+++ uw-imap-2002edebian1/debian/uw-imapd.preinst
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+PROGRAM=uw-imapd
+
+MY_FILE=/var/cache/${PROGRAM}_inetd.conf_copy
+
+if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" le 7:2002edebian1-6
+then
+    # See Bug#295306: the postrm that will be called after unpacking
+    # will remove entries from /etc/inetd.conf, so we save them for
+    # restoring them in the postinst.
+    grep -E "^([# ]+|#<off># +)?imap[23s]" /etc/inetd.conf >>"$MY_FILE"
+fi
+
only in patch2:
unchanged:
--- uw-imap-2002edebian1.orig/debian/ipopd.preinst
+++ uw-imap-2002edebian1/debian/ipopd.preinst
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+PROGRAM=ipopd
+
+MY_FILE=/var/cache/${PROGRAM}_inetd.conf_copy
+
+if [ "$1" = "upgrade" ] && dpkg --compare-versions "$2" le 7:2002edebian1-6
+then
+    # See Bug#295306: the postrm that will be called after unpacking
+    # will remove entries from /etc/inetd.conf, so we save them for
+    # restoring them in the postinst.
+    grep -E "^([# ]+|#<off># +)?imap[23s]" /etc/inetd.conf >>"$MY_FILE"
+fi
+

Attachment: signature.asc
Description: Digital signature

Reply via email to