From 22829cc44acf7d773a62638375709f1454028671 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 22 Jul 2010 13:45:53 -0400 Subject: [PATCH] Install sudoers as /etc/sudoers on RPM and debian systems where the package manager will not replace a user-modified configuration file. This fixes upgrades from the vendor sudo packages. --HG-- branch : 1.7 --- Makefile.in | 4 +--- configure | 18 +++++++++--------- configure.in | 2 +- sudo.pp | 27 ++++++++++++++++----------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/Makefile.in b/Makefile.in index 38dee6c25..137dd7c0b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -541,11 +541,9 @@ package: sudo.pp DESTDIR=`cd $(top_builddir) && pwd`/destdir; rm -rf $$DESTDIR; \ $(SHELL) $(srcdir)/mkinstalldirs $$DESTDIR/$(timedir) && \ $(MAKE) install DESTDIR=$$DESTDIR && \ - mv $$DESTDIR/$(sysconfdir)/sudoers \ - $$DESTDIR/$(sysconfdir)/sudoers.dist && \ $(SHELL) $(srcdir)/pp \ --destdir=$$DESTDIR \ - $(srcdir)/sudo.pp \ + $(srcdir)/sudo.pp \ bindir=$(bindir) \ sbindir=$(sbindir) \ libexecdir=$(libexecdir) \ diff --git a/configure b/configure index 410289203..a749c98f2 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for sudo 1.7.4. +# Generated by GNU Autoconf 2.65 for sudo 1.7.4b4. # # Report bugs to . # @@ -701,8 +701,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sudo' PACKAGE_TARNAME='sudo' -PACKAGE_VERSION='1.7.4' -PACKAGE_STRING='sudo 1.7.4' +PACKAGE_VERSION='1.7.4b4' +PACKAGE_STRING='sudo 1.7.4b4' PACKAGE_BUGREPORT='http://www.sudo.ws/bugs/' PACKAGE_URL='' @@ -1551,7 +1551,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sudo 1.7.4 to adapt to many kinds of systems. +\`configure' configures sudo 1.7.4b4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1616,7 +1616,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sudo 1.7.4:";; + short | recursive ) echo "Configuration of sudo 1.7.4b4:";; esac cat <<\_ACEOF @@ -1826,7 +1826,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sudo configure 1.7.4 +sudo configure 1.7.4b4 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2347,7 +2347,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sudo $as_me 1.7.4, which was +It was created by sudo $as_me 1.7.4b4, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -18706,7 +18706,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sudo $as_me 1.7.4, which was +This file was extended by sudo $as_me 1.7.4b4, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -18772,7 +18772,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sudo config.status 1.7.4 +sudo config.status 1.7.4b4 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff --git a/configure.in b/configure.in index 9070fecb1..fcdf2d768 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ dnl Process this file with GNU autoconf to produce a configure script. dnl dnl Copyright (c) 1994-1996,1998-2010 Todd C. Miller dnl -AC_INIT([sudo], [1.7.4], [http://www.sudo.ws/bugs/], [sudo]) +AC_INIT([sudo], [1.7.4b4], [http://www.sudo.ws/bugs/], [sudo]) AC_CONFIG_HEADER(config.h pathnames.h) dnl dnl This won't work before AC_INIT diff --git a/sudo.pp b/sudo.pp index 7df939e05..1023ad589 100644 --- a/sudo.pp +++ b/sudo.pp @@ -19,6 +19,11 @@ still allow people to get their work done." pp_deb_maintainer="Todd.Miller@courtesan.com" pp_sd_vendor_tag="TCM" pp_solaris_name="${pp_sd_vendor_tag}${name}" +%if [!rpm,deb] + # For all but RPM and Debian we need to install sudoers with a different + # name and make a copy of it if there is no existing file. + mv ${pp_destdir}$sudoersdir/sudoers ${pp_destdir}$sudoersdir/sudoers.dist +%endif %set [rpm] # Add distro info to release @@ -32,13 +37,11 @@ still allow people to get their work done." ;; esac - # Uncomment some Defaults in sudoers.dist + # Uncomment some Defaults in sudoers # Note that the order must match that of sudoers. case "$pp_rpm_distro" in centos*|rhel*) - # Uncomment some Defaults in sudoers.dist, must be tab indented. - # Note that the order must match that of sudoers. - /bin/ed - ${pp_destdir}${sudoersdir}/sudoers.dist <<-'EOF' + /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /Desktop path settings/+1,s/^# // w @@ -46,9 +49,7 @@ still allow people to get their work done." EOF ;; sles*) - # Uncomment some Defaults in sudoers.dist, must be tab indented. - # Note that the order must match that of sudoers. - /bin/ed - ${pp_destdir}${sudoersdir}/sudoers.dist <<-'EOF' + /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /ConsoleKit session/+1,s/^# // w @@ -118,9 +119,9 @@ still allow people to get their work done." esac %set [deb] - # Uncomment some Defaults and the %sudo rule in sudoers.dist + # Uncomment some Defaults and the %sudo rule in sudoers # Note that the order must match that of sudoers and be tab-indented. - /bin/ed - ${pp_destdir}${sudoersdir}/sudoers.dist <<-'EOF' + /bin/ed - ${pp_destdir}${sudoersdir}/sudoers <<-'EOF' /Locale settings/+1,s/^# // /X11 resource/+1,s/^# // /^# \%sudo/,s/^# // @@ -148,12 +149,16 @@ still allow people to get their work done." $sbindir/visudo 0111 $bindir/sudoreplay 0111 $libexecdir/* - $sudoersdir/sudoers.dist $sudoers_mode $sudoers_uid:$sudoers_gid volatile $sudoersdir/sudoers.d/ 0750 $sudoers_uid:$sudoers_gid $timedir/ 0700 root: $docdir/ $docdir/* /etc/pam.d/* volatile,optional +%if [rpm,deb] + $sudoersdir/sudoers $sudoers_mode $sudoers_uid:$sudoers_gid volatile +%else + $sudoersdir/sudoers.dist $sudoers_mode $sudoers_uid:$sudoers_gid volatile +%endif %files [!aix] $mandir/man*/* @@ -163,7 +168,7 @@ still allow people to get their work done." $mandir/cat*/* optional $mandir/man*/* optional -%post +%post [!rpm,deb] # Don't overwrite an existing sudoers file sudoersdir=%{sudoersdir} if test ! -r $sudoersdir/sudoers; then -- 2.40.0