tags 639530 + patch
thanks 

Hi, 

find attached a simple patch that modifies sudo-ldap.postinst and
sudo-ldap.postrm in a way that adds "sudoers:        files ldap"
to etc/nsswitch.conf after installation and removes it if the package
is removed.

Best regards,

     Andi
--- sudo-1.7.4p6/debian/sudo-ldap.postinst_orig 2011-08-29 10:58:04.000000000 
+0200
+++ sudo-1.7.4p6/debian/sudo-ldap.postinst      2011-08-29 12:04:08.000000000 
+0200
@@ -9,6 +9,16 @@
        print "WARNING:  /etc/sudoers not present!\n";
 }
 
+# modify nsswitch.conf if needed
+my $NSSWITCH = "/etc/nsswitch.conf";
+if ( -w $NSSWITCH) {
+    open(FILE, "+<", $NSSWITCH);
+    if ( ! grep{/^sudoers:/} <FILE> ){
+       print FILE "sudoers:        files ldap\n";
+    }
+    close FILE;
+}
+
 # handle state directory transition from /var/run/sudo to /var/lib/sudo,
 # moving any existing content over to avoid re-lecturing existing users
 if ( -d "/var/run/sudo") {
--- sudo-1.7.4p6/debian/sudo-ldap.postrm_orig   2011-08-29 10:58:15.000000000 
+0200
+++ sudo-1.7.4p6/debian/sudo-ldap.postrm        2011-08-29 12:38:15.000000000 
+0200
@@ -18,4 +18,11 @@
   ;;
 esac
 
+# modify nsswitch.conf
+NSSWITCH="/etc/nsswitch.conf"
+
+if [ -w  $NSSWITCH ] ; then
+    sed -i /^sudoers:/d $NSSWITCH
+fi
+
 #DEBHELPER#

Reply via email to