]> granicus.if.org Git - sudo/commitdiff
Add ldap "flavor" for debian, controlled by the SUDO_FLAVOR environment
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 14 Jul 2010 16:37:00 +0000 (12:37 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 14 Jul 2010 16:37:00 +0000 (12:37 -0400)
variable.

--HG--
branch : 1.7

Makefile.in
mkpkg
sudo.pp

index 4441b2694d14b40836fa6b87e26d1692bead50e9..5d0ec8db73584738d3735b528d6050d696cd7a8a 100644 (file)
@@ -499,7 +499,8 @@ install-sudoers: install-dirs
                $(srcdir)/sudoers $(DESTDIR)$(sudoersdir)/sudoers
 
 install-doc: install-dirs ChangeLog
-       (cd $(srcdir) && for f in ChangeLog HISTORY LICENSE README* TROUBLESHOOTING UPGRADE WHATSNEW sample.* schema.* sudoers2ldif; do $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 $$f $(DESTDIR)$(docdir); done)
+       (cd $(srcdir) && for f in ChangeLog HISTORY LICENSE README TROUBLESHOOTING UPGRADE WHATSNEW sample.*; do $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 $$f $(DESTDIR)$(docdir); done)
+       @LDAP@(cd $(srcdir) && for f in README.LDAP schema.* sudoers2ldif; do $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 $$f $(DESTDIR)$(docdir); done)
        $(INSTALL) -O $(install_uid) -G $(install_gid) -M 0444 @mansrcdir@/sudo.$(mantype) $(DESTDIR)$(mandirsu)/sudo.$(mansectsu)
        @rm -f $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
        ln $(DESTDIR)$(mandirsu)/sudo.$(mansectsu) $(DESTDIR)$(mandirsu)/sudoedit.$(mansectsu)
diff --git a/mkpkg b/mkpkg
index cb78e8d7612a5d532676f2e91379d27f84fd1141..d48dc77cb80e536e00b98cff6a734c3453eab789 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -3,7 +3,6 @@
 # Build a binary package using polypkg
 # Usage: mkpkg
 #
-# TODO: add flavors (e.g. LDAP)
 
 IFS=
 
@@ -147,14 +146,16 @@ case "$platform" in
     deb[456].*)
        # XXX - create sudo group like debian does
        #       debian now has a %sudo entry in its sample sudoers
-       # XXX - debian has separate ldap and non-ldap packages
        # Note, must indent with tabs, not spaces due to IFS trickery
-       configure_opts="
+       if test "${SUDO_FLAVOR:-vanilla}" == "ldap"; then
+           configure_opts="--with-ldap
+               --with-ldap-conf-file=/etc/sudo-ldap.conf"
+       fi
+       configure_opts="$configure_opts
                --prefix=/usr
                --with-all-insults
                --with-exempt=sudo
                --with-pam
-               --with-ldap
                --with-fqdn
                --with-logging=syslog
                --with-logfac=authpriv
@@ -167,7 +168,6 @@ case "$platform" in
                --disable-root-mailer
                --disable-setresuid
                --with-sendmail=/usr/sbin/sendmail
-               --with-ldap-conf-file=/etc/ldap/ldap.conf
                --mandir=/usr/share/man
                --libexecdir=/usr/lib/sudo
                --with-secure-path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin"
diff --git a/sudo.pp b/sudo.pp
index 71a7ed737266aac7e250f45de7a5deb164c32577..451cd5c144869766099d3704bb5df60f9b9bd685 100644 (file)
--- a/sudo.pp
+++ b/sudo.pp
@@ -1,5 +1,9 @@
 %set
-  name="sudo"
+  if test -n "$SUDO_FLAVOR"; then
+    name="sudo-$SUDO_FLAVOR"
+  else
+    name="sudo"
+  fi
   summary="Provide limited super-user priveleges to specific users"
   description="Sudo is a program designed to allow a sysadmin to give \
 limited root privileges to users and log root activity.  \
@@ -149,6 +153,14 @@ still allow people to get their work done."
   # installs it 0640 when sudo requires 0440
   chmod %{sudoers_mode} %{sudoersdir}/sudoers
 
+  # create symlink to ease transition to new path for ldap config
+  # if old config file exists and new one doesn't
+  if test X"%{SUDO_FLAVOR}" = X"ldap"; then
+    if test -r /etc/ldap/ldap.conf -a ! -r /etc/sudo-ldap.conf; then
+      ln -s /etc/ldap/ldap.conf /etc/sudo-ldap.conf
+    fi
+  fi
+
   # Debian uses a sudo group in its default sudoers file
   perl -e '
     exit 0 if getgrnam("sudo");