]> granicus.if.org Git - sudo/commitdiff
Make exampledir configurable and default to DATAROOTDIR/examples/sudo
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 6 Apr 2015 21:10:26 +0000 (15:10 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 6 Apr 2015 21:10:26 +0000 (15:10 -0600)
on BSD systems.

INSTALL
Makefile.in
configure
configure.ac
doc/sudoers.mdoc.in
examples/Makefile.in
mkpkg
sudo.pp

diff --git a/INSTALL b/INSTALL
index f1f0f4e34b611a29bdeb3466402eee1c7ad0eb00..ae6916acaf5cbcb0ec996753490eb2856f75b2a5 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -122,6 +122,9 @@ Directory and file names:
   --docdir=DIR
        Install other sudo documentation in DIR [DATAROOTDIR/doc/sudo]
 
+  --with-exampledir=DIR
+       Install sudo example files in DIR [DATAROOTDIR/doc/sudo/examples]
+
   --with-plugindir=DIR
        Set the directory that sudo looks in to find the policy and I/O
        logging plugins.  Defaults to the LIBEXEC/sudo.
index f410a3634b78290052cd600fe855b263a60d1b65..76ca6a7e0f443692b678585cacea40b64fdc930f 100644 (file)
@@ -31,6 +31,7 @@ includedir = @includedir@
 datarootdir = @datarootdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
+exampledir = @exampledir@
 docdir = @docdir@
 mandir = @mandir@
 rundir = @rundir@
@@ -305,6 +306,7 @@ package: $(srcdir)/sudo.pp
            mandir=$(mandir) \
            localedir=$(localedir) \
            docdir=$(docdir) \
+           exampledir=$(exampledir) \
            sysconfdir=$(sysconfdir) \
            sudoersdir=$(sudoersdir) \
            sudoers_uid=$(sudoers_uid) \
index 6e60713cd5c8191474ce3df88349b0eeaae58cde..b47b7575906c2e65883768cb360db159e135943b 100755 (executable)
--- a/configure
+++ b/configure
@@ -723,6 +723,7 @@ timeout
 vardir
 rundir
 iolog_dir
+exampledir
 COMPAT_EXP
 RC_LINK
 INIT_DIR
@@ -922,6 +923,7 @@ with_secure_path
 with_interfaces
 with_stow
 with_askpass
+with_exampledir
 with_plugindir
 with_man
 with_mdoc
@@ -1730,6 +1732,7 @@ Optional Packages:
   --without-interfaces    don't try to read the ip addr of ether interfaces
   --with-stow             deprecated
   --with-askpass=PATH     Fully qualified pathname of askpass helper
+  --with-exampledir=DIR   path to install sudo examples in
   --with-plugindir=DIR    set directory to load plugins from
   --with-man              manual pages use man macros
   --with-mdoc             manual pages use mdoc macros
@@ -2839,6 +2842,7 @@ $as_echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;}
 
 
 
+
 
 
 #
@@ -2889,6 +2893,7 @@ PLUGINDIR=/usr/local/libexec/sudo
 # End initial values for man page substitution
 #
 INSTALL_NOEXEC=
+exampledir='$(docdir)/examples'
 devdir='$(srcdir)'
 PROGS="sudo"
 : ${MANDIRTYPE='man'}
@@ -4633,9 +4638,9 @@ fi
 # Check whether --with-vardir was given.
 if test "${with_vardir+set}" = set; then :
   withval=$with_vardir; case $with_vardir in
-    yes)       as_fn_error $? "\"must give --with-vardirdir an argument.\"" "$LINENO" 5
+    yes)       as_fn_error $? "\"must give --with-vardir an argument.\"" "$LINENO" 5
                ;;
-    no)                as_fn_error $? "\"--without-vardirdir not supported.\"" "$LINENO" 5
+    no)                as_fn_error $? "\"--without-vardir not supported.\"" "$LINENO" 5
                ;;
 esac
 fi
@@ -5248,6 +5253,19 @@ EOF
 fi
 
 
+# Check whether --with-exampledir was given.
+if test "${with_exampledir+set}" = set; then :
+  withval=$with_exampledir; case $with_exampledir in
+    yes)       as_fn_error $? "\"must give --with-exampledir an argument.\"" "$LINENO" 5
+               ;;
+    no)                as_fn_error $? "\"--without-exampledir not supported.\"" "$LINENO" 5
+               ;;
+    *)         exampledir="$with_exampledir"
+esac
+fi
+
+
+
 # Check whether --with-plugindir was given.
 if test "${with_plugindir+set}" = set; then :
   withval=$with_plugindir; case $with_plugindir in
@@ -15100,6 +15118,11 @@ done
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*openbsd*)
                # OpenBSD-specific initialization
@@ -15118,6 +15141,11 @@ done
                    fi
                fi
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*netbsd*)
                # NetBSD has a real setreuid(2) starting with 1.3.2
@@ -15129,6 +15157,11 @@ done
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-dragonfly*)
                OSDEFS="${OSDEFS} -D_BSD_SOURCE"
@@ -15138,9 +15171,18 @@ done
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='yes'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*bsd*)
                CHECKSHADOW="false"
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-darwin*)
                # Darwin has a real setreuid(2) starting with 9.0
@@ -15161,6 +15203,11 @@ done
                    RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
                fi
                RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-nextstep*)
                # lockf() is broken on the NeXT -- use flock instead
index 818181351c10653c01028702e6dd5b1a39a33c2c..6dc147b649036ab1df64040919063c146b6fccf6 100644 (file)
@@ -90,6 +90,7 @@ AC_SUBST([INIT_SCRIPT])
 AC_SUBST([INIT_DIR])
 AC_SUBST([RC_LINK])
 AC_SUBST([COMPAT_EXP])
+AC_SUBST([exampledir])
 dnl
 dnl Variables that get substituted in docs (not overridden by environment)
 dnl
@@ -185,6 +186,7 @@ dnl Initial values for Makefile variables listed above
 dnl May be overridden by environment variables..
 dnl
 INSTALL_NOEXEC=
+exampledir='$(docdir)/examples'
 devdir='$(srcdir)'
 PROGS="sudo"
 : ${MANDIRTYPE='man'}
@@ -817,9 +819,9 @@ esac])
 
 AC_ARG_WITH(vardir, [AS_HELP_STRING([--with-vardir=DIR], [path to the sudo var dir])],
 [case $with_vardir in
-    yes)       AC_MSG_ERROR(["must give --with-vardirdir an argument."])
+    yes)       AC_MSG_ERROR(["must give --with-vardir an argument."])
                ;;
-    no)                AC_MSG_ERROR(["--without-vardirdir not supported."])
+    no)                AC_MSG_ERROR(["--without-vardir not supported."])
                ;;
 esac])
 
@@ -1196,6 +1198,15 @@ else
     SUDO_DEFINE_UNQUOTED(_PATH_SUDO_ASKPASS, NULL)
 fi
 
+AC_ARG_WITH(exampledir, [AS_HELP_STRING([--with-exampledir=DIR], [path to install sudo examples in])],
+[case $with_exampledir in
+    yes)       AC_MSG_ERROR(["must give --with-exampledir an argument."])
+               ;;
+    no)                AC_MSG_ERROR(["--without-exampledir not supported."])
+               ;;
+    *)         exampledir="$with_exampledir"
+esac])
+
 AC_ARG_WITH(plugindir, [AS_HELP_STRING([--with-plugindir=DIR], [set directory to load plugins from])],
 [case $with_plugindir in
     no)                AC_MSG_ERROR(["illegal argument: --without-plugindir."])
@@ -2004,6 +2015,11 @@ case "$host" in
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*openbsd*)
                # OpenBSD-specific initialization
@@ -2022,6 +2038,11 @@ case "$host" in
                    fi
                fi
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*netbsd*)
                # NetBSD has a real setreuid(2) starting with 1.3.2
@@ -2033,6 +2054,11 @@ case "$host" in
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='maybe'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-dragonfly*)
                OSDEFS="${OSDEFS} -D_BSD_SOURCE"
@@ -2042,9 +2068,18 @@ case "$host" in
                CHECKSHADOW="false"
                test -z "$with_pam" && AUTH_EXCL_DEF="PAM"
                : ${with_logincap='yes'}
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-*bsd*)
                CHECKSHADOW="false"
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-darwin*)
                # Darwin has a real setreuid(2) starting with 9.0
@@ -2064,6 +2099,11 @@ case "$host" in
                    RTLD_PRELOAD_ENABLE_VAR="DYLD_FORCE_FLAT_NAMESPACE"
                fi
                RTLD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
+
+               # Examples go in share/examples/sudo
+               if test X"$with_exampledir" = X""; then
+                   exampledir='$(datarootdir)/examples/$(PACKAGE_TARNAME)'
+               fi
                ;;
     *-*-nextstep*)
                # lockf() is broken on the NeXT -- use flock instead
index a84f447ccc6ef4b7d6fbb7809b7617acdb8de6dd..2fe0cb3294ec3e8c0126dda0c188e6a76faaaa56 100644 (file)
@@ -19,7 +19,7 @@
 .\" Agency (DARPA) and Air Force Research Laboratory, Air Force
 .\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
 .\"
-.Dd February 26, 2015
+.Dd March 24, 2015
 .Dt SUDOERS @mansectform@
 .Os Sudo @PACKAGE_VERSION@
 .Sh NAME
@@ -4256,6 +4256,21 @@ is a built-in command, it must be specified in
 .Em sudoers
 without a leading path.
 However, it may take command line arguments just as a normal command does.
+Wildcards used in
+.Em sudoedit
+command line arguments are expected to be path names, so a forward slash
+.Pq Ql /
+will not be matched by a wildcard.
+.Pp
+Unlike other
+.Nm sudo
+commands, the editor is run with the permissions of the invoking
+user and with the environment unmodified.
+More information may be found in the description of the
+.Fl e
+option in
+.Xr sudo @mansectsu@ .
+.Pp
 For example, to allow user operator to edit the
 .Dq message of the day
 file:
index 01eb0512160892a6256dc18d7cf6454d7fce22e7..c82dd788ebcc28199f304ed190334ce55ac5932f 100644 (file)
@@ -21,7 +21,7 @@
 
 srcdir = @srcdir@
 docdir = @docdir@
-exampledir = $(docdir)/examples
+exampledir = @exampledir@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
diff --git a/mkpkg b/mkpkg
index efc08a6864081365d9814d1eff107cc97c0b72bd..abd6585a4fcf1ef7699e57115c5beee8fdd1922d 100755 (executable)
--- a/mkpkg
+++ b/mkpkg
@@ -163,6 +163,7 @@ case "$osversion" in
        # XXX - SuSE uses secure path but only for env_reset
        configure_opts="--prefix=/usr
                --libexecdir=/usr/$libexec
+               --docdir='$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
                --with-logging=syslog
                --with-logfac=auth
                --with-all-insults
@@ -178,7 +179,7 @@ case "$osversion" in
                --with-sendmail=/usr/sbin/sendmail
                $configure_opts"
 
-       make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
+       #make_opts='docdir=$(datarootdir)/doc/packages/$(PACKAGE_TARNAME)'
        ;;
     deb*|ubu*)
        # Man pages should be compressed in .deb files
diff --git a/sudo.pp b/sudo.pp
index 930cc5b20824e814b4fa0bad0d0952dc282d42a3..6563de85bbb6bff7524fc682010e9c6c4f13b234 100644 (file)
--- a/sudo.pp
+++ b/sudo.pp
@@ -125,8 +125,12 @@ still allow people to get their work done."
        # For RedHat the doc dir is expected to include version and release
        case "$pp_rpm_distro" in
        centos*|rhel*)
-               mv ${pp_destdir}/${docdir} ${pp_destdir}/${docdir}-${version}-${pp_rpm_release}
-               docdir=${docdir}-${version}-${pp_rpm_release}
+               rhel_docdir="${docdir}-${pp_rpm_version}-${pp_rpm_release}"
+               if test "`dirname ${exampledir}`" = "${docdir}"; then
+                   exampledir="${rhel_docdir}/`basename ${exampledir}`"
+               fi
+               mv "${pp_destdir}/${docdir}" "${pp_destdir}/${rhel_docdir}"
+               docdir="${rhel_docdir}"
                ;;
        esac
 
@@ -228,6 +232,7 @@ still allow people to get their work done."
        if test "${prefix}" != "/usr"; then
            extradirs=`echo ${pp_destdir}/${mandir}/[mc]* | sed "s#${pp_destdir}/##g"`
            extradirs="$extradirs `dirname $docdir` `dirname $rundir` `dirname $vardir`"
+           test "`dirname $exampledir`" != "$docdir" && extradirs="$extradirs `dirname $exampledir`"
            test -d ${pp_destdir}${localedir} && extradirs="$extradirs $localedir"
            for dir in $bindir $sbindir $libexecdir $includedir $extradirs; do
                    while test "$dir" != "/"; do
@@ -279,8 +284,9 @@ still allow people to get their work done."
        $docdir/LICENSE         ignore,ignore-others
        $docdir/ChangeLog       ignore,ignore-others
 %endif
-       $docdir/examples/       0755 ignore-others
-       $docdir/**              0644
+       $exampledir/            0755 ignore-others
+       $exampledir/*           0644
+       $docdir/*               0644
        $localedir/*/           -    optional
        $localedir/*/LC_MESSAGES/ -    optional
        $localedir/*/LC_MESSAGES/* 0644    optional