From: Todd C. Miller Date: Fri, 28 Jan 2011 21:50:49 +0000 (-0500) Subject: Add --disable-env-reset configure option. X-Git-Tag: SUDO_1_7_5~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=259276948d67ec56244c02d4f14a3f17b56ca647;p=sudo Add --disable-env-reset configure option. --HG-- branch : 1.7 --- diff --git a/INSTALL b/INSTALL index de29fdc67..d9568d3ff 100644 --- a/INSTALL +++ b/INSTALL @@ -640,6 +640,10 @@ The following options are also configurable at runtime: Enable the creation of an Ubuntu-style admin flag file the first time sudo is run. + --disable-env-reset + Disable environment resetting. This sets the default value + of the "env_reset" Defaults option in sudoers to false. + Shadow password and C2 support ============================== diff --git a/NEWS b/NEWS index 3e9cca89e..39cb6539b 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,10 @@ What's new in Sudo 1.7.5? by the "sudoers_locale" setting ("C" by default). Email send by sudo now includes MIME headers when "sudoers_locale" is not "C". + * The configure script has a new option, --disable-env-reset, to + allow one to change the default for the sudoers Default setting + "env_reset" at compile time. + What's new in Sudo 1.7.4p6? * A bug has been fixed in the I/O logging support that could cause diff --git a/config.h.in b/config.h.in index 1c12befd0..a8e21ba80 100644 --- a/config.h.in +++ b/config.h.in @@ -27,6 +27,9 @@ variables. */ #undef ENV_EDITOR +/* Define to 1 to enable environment resetting by default. */ +#undef ENV_RESET + /* If defined, users in this group need not enter a passwd (ie "sudo"). */ #undef EXEMPTGROUP diff --git a/configure b/configure index e4a1833e3..18ca93e2d 100755 --- a/configure +++ b/configure @@ -794,6 +794,7 @@ root_sudo insults tty_tickets passwd_tries +env_reset env_editor runas_default fqdn @@ -987,6 +988,7 @@ enable_noargs_shell enable_shell_sets_home enable_path_info enable_env_debug +enable_env_reset enable_warnings enable_admin_flag with_selinux @@ -1643,6 +1645,7 @@ Optional Features: Set $HOME to target user in shell mode --disable-path-info Print 'command not allowed' not 'command not found' --enable-env-debug Whether to enable environment debugging. + --enable-env-reset Whether to enable environment resetting by default. --enable-warnings Whether to enable compiler warnings --enable-admin-flag Whether to create a Ubuntu-style admin flag file --enable-gss-krb5-ccache-name @@ -2959,6 +2962,7 @@ $as_echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;} + # @@ -2987,6 +2991,7 @@ badpass_message="Sorry, try again." fqdn=off runas_default=root env_editor=off +env_reset=on editor=vi passwd_tries=3 tty_tickets=on @@ -5608,6 +5613,35 @@ $as_echo "no" >&6; } fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable environment resetting by default" >&5 +$as_echo_n "checking whether to enable environment resetting by default... " >&6; } +# Check whether --enable-env_reset was given. +if test "${enable_env_reset+set}" = set; then : + enableval=$enable_env_reset; case "$enableval" in + yes) env_reset=on + ;; + no) env_reset=off + ;; + *) env_reset=on + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring unknown argument to --enable-env-reset: $enableval" >&5 +$as_echo "$as_me: WARNING: Ignoring unknown argument to --enable-env-reset: $enableval" >&2;} + ;; + esac + +fi + +if test "$env_reset" = "on"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + $as_echo "#define ENV_RESET TRUE" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + $as_echo "#define ENV_RESET FALSE" >>confdefs.h + +fi + # Check whether --enable-warnings was given. if test "${enable_warnings+set}" = set; then : enableval=$enable_warnings; case "$enableval" in @@ -6793,13 +6827,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:6796: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6830: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6799: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6833: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6802: output\"" >&5) + (eval echo "\"\$as_me:6836: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -8004,7 +8038,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 8007 "configure"' > conftest.$ac_ext + echo '#line 8041 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9397,11 +9431,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9400: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9434: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9404: \$? = $ac_status" >&5 + echo "$as_me:9438: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9736,11 +9770,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9739: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9773: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9743: \$? = $ac_status" >&5 + echo "$as_me:9777: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -9841,11 +9875,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9844: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9878: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9848: \$? = $ac_status" >&5 + echo "$as_me:9882: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -9896,11 +9930,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:9899: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9933: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9903: \$? = $ac_status" >&5 + echo "$as_me:9937: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12263,7 +12297,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12266 "configure" +#line 12300 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12359,7 +12393,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12362 "configure" +#line 12396 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21049,5 +21083,6 @@ fi + diff --git a/configure.in b/configure.in index f8d8ed688..e6d9ecb9d 100644 --- a/configure.in +++ b/configure.in @@ -81,6 +81,7 @@ AC_SUBST([badpass_message]) AC_SUBST([fqdn]) AC_SUBST([runas_default]) AC_SUBST([env_editor]) +AC_SUBST([env_reset]) AC_SUBST([passwd_tries]) AC_SUBST([tty_tickets]) AC_SUBST([insults]) @@ -118,6 +119,7 @@ badpass_message="Sorry, try again." fqdn=off runas_default=root env_editor=off +env_reset=on editor=vi passwd_tries=3 tty_tickets=on @@ -1272,6 +1274,27 @@ AC_ARG_ENABLE(env_debug, esac ], AC_MSG_RESULT(no)) +AC_MSG_CHECKING(whether to enable environment resetting by default) +AC_ARG_ENABLE(env_reset, +[AS_HELP_STRING([--enable-env-reset], [Whether to enable environment resetting by default.])], +[ case "$enableval" in + yes) env_reset=on + ;; + no) env_reset=off + ;; + *) env_reset=on + AC_MSG_WARN([Ignoring unknown argument to --enable-env-reset: $enableval]) + ;; + esac +]) +if test "$env_reset" = "on"; then + AC_MSG_RESULT(yes) + AC_DEFINE(ENV_RESET, TRUE) +else + AC_MSG_RESULT(no) + AC_DEFINE(ENV_RESET, FALSE) +fi + AC_ARG_ENABLE(warnings, [AS_HELP_STRING([--enable-warnings], [Whether to enable compiler warnings])], [ case "$enableval" in @@ -2880,6 +2903,7 @@ AH_TEMPLATE(CSOPS_INSULTS, [Define to 1 if you want insults culled from the twis AH_TEMPLATE(DONT_LEAK_PATH_INFO, [Define to 1 if you want sudo to display "command not allowed" instead of "command not found" when a command cannot be found.]) AH_TEMPLATE(ENV_EDITOR, [Define to 1 if you want visudo to honor the EDITOR and VISUAL env variables.]) AH_TEMPLATE(ENV_DEBUG, [Define to 1 to enable environment function debugging.]) +AH_TEMPLATE(ENV_RESET, [Define to 1 to enable environment resetting by default.]) AH_TEMPLATE(FQDN, [Define to 1 if you want to require fully qualified hosts in sudoers.]) AH_TEMPLATE(GOONS_INSULTS, [Define to 1 if you want insults from the "Goon Show".]) AH_TEMPLATE(HAL_INSULTS, [Define to 1 if you want 2001-like insults.]) diff --git a/defaults.c b/defaults.c index 5f475df45..c1f0afa76 100644 --- a/defaults.c +++ b/defaults.c @@ -441,7 +441,7 @@ init_defaults() #endif def_iolog_dir = estrdup(_PATH_SUDO_IO_LOGDIR); def_sudoers_locale = estrdup("C"); - def_env_reset = TRUE; + def_env_reset = ENV_RESET; def_set_logname = TRUE; def_closefrom = STDERR_FILENO + 1; diff --git a/sudoers.man.in b/sudoers.man.in index 95b3320d5..5cb767871 100644 --- a/sudoers.man.in +++ b/sudoers.man.in @@ -778,7 +778,7 @@ and \f(CW\*(C`env_check\*(C'\fR lists are then added. The default contents of t \&\f(CW\*(C`env_keep\*(C'\fR and \f(CW\*(C`env_check\*(C'\fR lists are displayed when \fBsudo\fR is run by root with the \fI\-V\fR option. If the \fIsecure_path\fR option is set, its value will be used for the \f(CW\*(C`PATH\*(C'\fR environment variable. -This flag is \fIon\fR by default. +This flag is \fI@env_reset@\fR by default. .IP "fast_glob" 16 .IX Item "fast_glob" Normally, \fBsudo\fR uses the \fIglob\fR\|(3) function to do shell-style diff --git a/sudoers.pod b/sudoers.pod index 4697be69b..a65a232ec 100644 --- a/sudoers.pod +++ b/sudoers.pod @@ -641,7 +641,7 @@ and C lists are then added. The default contents of the C and C lists are displayed when B is run by root with the I<-V> option. If the I option is set, its value will be used for the C environment variable. -This flag is I by default. +This flag is I<@env_reset@> by default. =item fast_glob