Package: sudo
Version: 1.6.8p12-5
Followup-For: Bug #397090

tags 397090 + patch
thanks

As documented in bug 397090, the sudo init script does not serve any useful
function, because by that point in the boot sequence, /etc/init.d/bootclean
has already run and cleaned /var/run.  The attached patch removes the
initscript, removes all references to the initscript, and adds the necessary
preinst magic to actually rm the initscript if unmodified and remove the
runlevel links to it.

- Josh Triplett

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-rc1 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages sudo depends on:
ii  libc6                         2.5-10     GNU C Library: Shared libraries
ii  libpam-modules                0.79-4     Pluggable Authentication Modules f
ii  libpam0g                      0.79-4     Pluggable Authentication Modules l

sudo recommends no packages.

-- no debconf information
diff -Naur sudo-1.6.8p12.orig/debian/init.d sudo-1.6.8p12/debian/init.d
--- sudo-1.6.8p12.orig/debian/init.d    2007-06-08 20:41:10.000000000 -0700
+++ sudo-1.6.8p12/debian/init.d 1969-12-31 16:00:00.000000000 -0800
@@ -1,31 +0,0 @@
-#! /bin/sh
-
-### BEGIN INIT INFO
-# Provides:          sudo
-# Required-Start:    $local_fs $remote_fs
-# Required-Stop:
-# Default-Start:     S 2 3 4 5
-# Default-Stop:      0 1 6
-### END INIT INFO
-
-N=/etc/init.d/sudo
-
-set -e
-
-case "$1" in
-  start)
-       # make sure privileges don't persist across reboots
-       if [ -d /var/run/sudo ]
-       then
-                find /var/run/sudo -type f -exec touch -t 198501010000 '{}' \;
-       fi
-       ;;
-  stop|reload|restart|force-reload)
-       ;;
-  *)
-       echo "Usage: $N {start|stop|restart|force-reload}" >&2
-       exit 1
-       ;;
-esac
-
-exit 0
diff -Naur sudo-1.6.8p12.orig/debian/postinst sudo-1.6.8p12/debian/postinst
--- sudo-1.6.8p12.orig/debian/postinst  2007-06-08 20:41:10.000000000 -0700
+++ sudo-1.6.8p12/debian/postinst       2007-06-08 21:18:25.000000000 -0700
@@ -30,11 +30,6 @@
 system ('chown root:root /etc/sudoers');
 system ('chmod 440 /etc/sudoers');
 
-# must do a remove first to un-do the "bad" links created by previous version
-system ('update-rc.d -f sudo remove >/dev/null 2>&1');
-
-system ('update-rc.d sudo start 75 S . >/dev/null');
-
 # make sure we have a sudo group
 
 exit 0 if getgrnam("sudo"); # we're finished if there is a group sudo
diff -Naur sudo-1.6.8p12.orig/debian/preinst sudo-1.6.8p12/debian/preinst
--- sudo-1.6.8p12.orig/debian/preinst   1969-12-31 16:00:00.000000000 -0800
+++ sudo-1.6.8p12/debian/preinst        2007-06-08 21:18:05.000000000 -0700
@@ -0,0 +1,26 @@
+#!/bin/sh
+rm_conffile() {
+    PKGNAME="$1"
+    CONFFILE="$2"
+
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e 
\"\\\\' $CONFFILE's/.* //p\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+            echo "Saving as $CONFFILE.dpkg-bak ..."
+            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+        else
+            echo "Removing obsolete conffile $CONFFILE ..."
+            rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le 1.6.8p12-5; then
+        rm_conffile sudo /etc/init.d/sudo
+        update-rc.d sudo remove
+    fi
+esac
diff -Naur sudo-1.6.8p12.orig/debian/rules sudo-1.6.8p12/debian/rules
--- sudo-1.6.8p12.orig/debian/rules     2007-06-08 20:41:10.000000000 -0700
+++ sudo-1.6.8p12/debian/rules  2007-06-08 21:18:05.000000000 -0700
@@ -100,7 +100,6 @@
        dh_testroot
        dh_installdocs
        dh_installexamples -A sudoers
-       dh_installinit -psudo -psudo-ldap
        dh_installmanpages fnmatch.3
        dh_installinfo -A
        dh_installchangelogs CHANGES
diff -Naur sudo-1.6.8p12.orig/debian/sudo-ldap.init.d 
sudo-1.6.8p12/debian/sudo-ldap.init.d
--- sudo-1.6.8p12.orig/debian/sudo-ldap.init.d  2007-06-08 20:41:10.000000000 
-0700
+++ sudo-1.6.8p12/debian/sudo-ldap.init.d       1969-12-31 16:00:00.000000000 
-0800
@@ -1,31 +0,0 @@
-#! /bin/sh
-
-### BEGIN INIT INFO
-# Provides:          sudo
-# Required-Start:    $local_fs $remote_fs
-# Required-Stop:
-# Default-Start:     S 1 2 3 4 5
-# Default-Stop:      0 6
-### END INIT INFO
-
-N=/etc/init.d/sudo
-
-set -e
-
-case "$1" in
-  start)
-       # make sure privileges don't persist across reboots
-       if [ -d /var/run/sudo ]
-       then
-                find /var/run/sudo -type f -exec touch -t 198501010000 '{}' \;
-       fi
-       ;;
-  stop|reload|restart|force-reload)
-       ;;
-  *)
-       echo "Usage: $N {start|stop|restart|force-reload}" >&2
-       exit 1
-       ;;
-esac
-
-exit 0
diff -Naur sudo-1.6.8p12.orig/debian/sudo-ldap.lintian 
sudo-1.6.8p12/debian/sudo-ldap.lintian
--- sudo-1.6.8p12.orig/debian/sudo-ldap.lintian 2007-06-08 20:41:10.000000000 
-0700
+++ sudo-1.6.8p12/debian/sudo-ldap.lintian      2007-06-08 21:18:05.000000000 
-0700
@@ -1,4 +1,2 @@
 sudo-ldap: setuid-binary usr/bin/sudo 4755 root/root
 sudo-ldap: setuid-binary usr/bin/sudoedit 4755 root/root
-sudo-ldap: postrm-contains-additional-updaterc.d-calls /etc/init.d/sudo-ldap
-sudo-ldap: script-in-etc-init.d-not-registered-via-update-rc.d 
/etc/init.d/sudo-ldap
diff -Naur sudo-1.6.8p12.orig/debian/sudo-ldap.postinst 
sudo-1.6.8p12/debian/sudo-ldap.postinst
--- sudo-1.6.8p12.orig/debian/sudo-ldap.postinst        2007-06-08 
20:41:10.000000000 -0700
+++ sudo-1.6.8p12/debian/sudo-ldap.postinst     2007-06-08 21:18:33.000000000 
-0700
@@ -28,11 +28,6 @@
 system ('chown root:root /etc/sudoers');
 system ('chmod 440 /etc/sudoers');
 
-# must do a remove first to un-do the "bad" links created by previous version
-system ('update-rc.d -f sudo remove >/dev/null 2>&1');
-
-system ('update-rc.d sudo start 75 S . >/dev/null');
-
 # make sure we have a sudo group
 
 exit 0 if getgrnam("sudo"); # we're finished if there is a group sudo
diff -Naur sudo-1.6.8p12.orig/debian/sudo-ldap.preinst 
sudo-1.6.8p12/debian/sudo-ldap.preinst
--- sudo-1.6.8p12.orig/debian/sudo-ldap.preinst 1969-12-31 16:00:00.000000000 
-0800
+++ sudo-1.6.8p12/debian/sudo-ldap.preinst      2007-06-08 21:18:05.000000000 
-0700
@@ -0,0 +1,26 @@
+#!/bin/sh
+rm_conffile() {
+    PKGNAME="$1"
+    CONFFILE="$2"
+
+    if [ -e "$CONFFILE" ]; then
+        md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
+        old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e 
\"\\\\' $CONFFILE's/.* //p\"`"
+        if [ "$md5sum" != "$old_md5sum" ]; then
+            echo "Obsolete conffile $CONFFILE has been modified by you."
+            echo "Saving as $CONFFILE.dpkg-bak ..."
+            mv -f "$CONFFILE" "$CONFFILE".dpkg-bak
+        else
+            echo "Removing obsolete conffile $CONFFILE ..."
+            rm -f "$CONFFILE"
+        fi
+    fi
+}
+
+case "$1" in
+install|upgrade)
+    if dpkg --compare-versions "$2" le 1.6.8p12-5; then
+        rm_conffile sudo-ldap /etc/init.d/sudo-ldap
+        update-rc.d sudo-ldap remove
+    fi
+esac
diff -Naur sudo-1.6.8p12.orig/debian/sudo.lintian 
sudo-1.6.8p12/debian/sudo.lintian
--- sudo-1.6.8p12.orig/debian/sudo.lintian      2007-06-08 20:41:10.000000000 
-0700
+++ sudo-1.6.8p12/debian/sudo.lintian   2007-06-08 21:18:05.000000000 -0700
@@ -1,4 +1,2 @@
 sudo: setuid-binary usr/bin/sudo 4755 root/root
 sudo: setuid-binary usr/bin/sudoedit 4755 root/root
-sudo: postrm-contains-additional-updaterc.d-calls /etc/init.d/sudo
-sudo: script-in-etc-init.d-not-registered-via-update-rc.d /etc/init.d/sudo

Reply via email to