From: Todd C. Miller Date: Wed, 14 Jul 2010 13:06:37 +0000 (-0400) Subject: Use a loop when searching for mv, sendmail and sh X-Git-Tag: SUDO_1_7_4~90 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1073d1f7800d4ed7b8219b04888bc74fd0b3b5c2;p=sudo Use a loop when searching for mv, sendmail and sh --HG-- branch : 1.7 --- diff --git a/aclocal.m4 b/aclocal.m4 index 6901da05f..1bf8a0a02 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -8,29 +8,20 @@ dnl dnl checks for programs dnl -dnl check for sendmail -dnl -AC_DEFUN(SUDO_PROG_SENDMAIL, [AC_MSG_CHECKING(for sendmail) -if test -f "/usr/sbin/sendmail"; then - AC_MSG_RESULT(/usr/sbin/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/sbin/sendmail") -elif test -f "/usr/lib/sendmail"; then - AC_MSG_RESULT(/usr/lib/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/lib/sendmail") -elif test -f "/usr/etc/sendmail"; then - AC_MSG_RESULT(/usr/etc/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/etc/sendmail") -elif test -f "/usr/ucblib/sendmail"; then - AC_MSG_RESULT(/usr/ucblib/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/ucblib/sendmail") -elif test -f "/usr/local/lib/sendmail"; then - AC_MSG_RESULT(/usr/local/lib/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/local/lib/sendmail") -elif test -f "/usr/local/bin/sendmail"; then - AC_MSG_RESULT(/usr/local/bin/sendmail) - SUDO_DEFINE(_PATH_SUDO_SENDMAIL, "/usr/local/bin/sendmail") -else - AC_MSG_RESULT(not found) +dnl check for sendmail in well-known locations +dnl +AC_DEFUN(SUDO_PROG_SENDMAIL, [AC_MSG_CHECKING([for sendmail]) +found=no +for p in "/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/etc/sendmail" "/usr/ucblib/sendmail" "/usr/local/lib/sendmail" "/usr/local/bin/sendmail"; do + if test -f "$p"; then + found=yes + AC_MSG_RESULT([$p]) + SUDO_DEFINE_UNQUOTED(_PATH_SUDO_SENDMAIL, "$p") + break + fi +done +if test X"$found" != X"yes"; then + AC_MSG_RESULT([not found]) fi ])dnl @@ -47,62 +38,44 @@ for editor in "/usr/bin/vi" "/bin/vi" "/usr/ucb/vi" "/usr/bsd/vi" "/usr/local/bi break fi done -if test X"$found" != X"no"; then - AC_MSG_RESULT(not found) +if test X"$found" != X"yes"; then + AC_MSG_RESULT([not found]) fi ])dnl dnl -dnl check for mv -dnl -AC_DEFUN(SUDO_PROG_MV, [AC_MSG_CHECKING(for mv) -if test -f "/usr/bin/mv"; then - AC_MSG_RESULT(/usr/bin/mv) - SUDO_DEFINE(_PATH_MV, "/usr/bin/mv") -elif test -f "/bin/mv"; then - AC_MSG_RESULT(/bin/mv) - SUDO_DEFINE(_PATH_MV, "/bin/mv") -elif test -f "/usr/ucb/mv"; then - AC_MSG_RESULT(/usr/ucb/mv) - SUDO_DEFINE(_PATH_MV, "/usr/ucb/mv") -elif test -f "/usr/sbin/mv"; then - AC_MSG_RESULT(/usr/sbin/mv) - SUDO_DEFINE(_PATH_MV, "/usr/sbin/mv") -else - AC_MSG_RESULT(not found) +dnl check for mv in well-known locations +dnl +AC_DEFUN(SUDO_PROG_MV, [AC_MSG_CHECKING([for mv]) +found=no +for p in "/usr/bin/mv" "/bin/mv" "/usr/ucb/mv" "/usr/sbin/mv"; do + if test -f "$p"; then + found=yes + AC_MSG_RESULT([$p]) + SUDO_DEFINE_UNQUOTED(_PATH_MV, "$p") + break + fi +done +if test X"$found" != X"yes"; then + AC_MSG_RESULT([not found]) fi ])dnl dnl -dnl check for bourne shell -dnl -AC_DEFUN(SUDO_PROG_BSHELL, [AC_MSG_CHECKING(for bourne shell) -if test -f "/bin/sh"; then - AC_MSG_RESULT(/bin/sh) - SUDO_DEFINE(_PATH_BSHELL, "/bin/sh") -elif test -f "/usr/bin/sh"; then - AC_MSG_RESULT(/usr/bin/sh) - SUDO_DEFINE(_PATH_BSHELL, "/usr/bin/sh") -elif test -f "/sbin/sh"; then - AC_MSG_RESULT(/sbin/sh) - SUDO_DEFINE(_PATH_BSHELL, "/sbin/sh") -elif test -f "/usr/sbin/sh"; then - AC_MSG_RESULT(/usr/sbin/sh) - SUDO_DEFINE(_PATH_BSHELL, "/usr/sbin/sh") -elif test -f "/bin/ksh"; then - AC_MSG_RESULT(/bin/ksh) - SUDO_DEFINE(_PATH_BSHELL, "/bin/ksh") -elif test -f "/usr/bin/ksh"; then - AC_MSG_RESULT(/usr/bin/ksh) - SUDO_DEFINE(_PATH_BSHELL, "/usr/bin/ksh") -elif test -f "/bin/bash"; then - AC_MSG_RESULT(/bin/bash) - SUDO_DEFINE(_PATH_BSHELL, "/bin/bash") -elif test -f "/usr/bin/bash"; then - AC_MSG_RESULT(/usr/bin/bash) - SUDO_DEFINE(_PATH_BSHELL, "/usr/bin/bash") -else - AC_MSG_RESULT(not found) +dnl check for bourne shell in well-known locations +dnl +AC_DEFUN(SUDO_PROG_BSHELL, [AC_MSG_CHECKING([for bourne shell]) +found=no +for p in "/bin/sh" "/usr/bin/sh" "/sbin/sh" "/usr/sbin/sh" "/bin/ksh" "/usr/bin/ksh" "/bin/bash" "/usr/bin/bash"; do + if test -f "$p"; then + found=yes + AC_MSG_RESULT([$p]) + SUDO_DEFINE_UNQUOTED(_PATH_BSHELL, "$p") + break + fi +done +if test X"$found" != X"yes"; then + AC_MSG_RESULT([not found]) fi ])dnl diff --git a/configure b/configure index 83043f8ab..872124f2b 100755 --- a/configure +++ b/configure @@ -2796,6 +2796,7 @@ badpass_message="Sorry, try again." fqdn=off runas_default=root env_editor=off +editor=vi passwd_tries=3 tty_tickets=off insults=off @@ -6627,13 +6628,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:6630: $ac_compile\"" >&5) + (eval echo "\"\$as_me:6631: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:6633: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:6634: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:6636: output\"" >&5) + (eval echo "\"\$as_me:6637: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -7838,7 +7839,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 7841 "configure"' > conftest.$ac_ext + echo '#line 7842 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -9231,11 +9232,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:9234: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9235: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9238: \$? = $ac_status" >&5 + echo "$as_me:9239: \$? = $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. @@ -9570,11 +9571,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:9573: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9574: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:9577: \$? = $ac_status" >&5 + echo "$as_me:9578: \$? = $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. @@ -9675,11 +9676,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:9678: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9679: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9682: \$? = $ac_status" >&5 + echo "$as_me:9683: \$? = $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 @@ -9730,11 +9731,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:9733: $lt_compile\"" >&5) + (eval echo "\"\$as_me:9734: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:9737: \$? = $ac_status" >&5 + echo "$as_me:9738: \$? = $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 @@ -12097,7 +12098,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12100 "configure" +#line 12101 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12193,7 +12194,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 12196 "configure" +#line 12197 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13466,98 +13467,40 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mv" >&5 $as_echo_n "checking for mv... " >&6; } -if test -f "/usr/bin/mv"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/bin/mv" >&5 -$as_echo "/usr/bin/mv" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_MV "/usr/bin/mv" -EOF - -elif test -f "/bin/mv"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /bin/mv" >&5 -$as_echo "/bin/mv" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_MV "/bin/mv" -EOF - -elif test -f "/usr/ucb/mv"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/ucb/mv" >&5 -$as_echo "/usr/ucb/mv" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_MV "/usr/ucb/mv" -EOF - -elif test -f "/usr/sbin/mv"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/sbin/mv" >&5 -$as_echo "/usr/sbin/mv" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_MV "/usr/sbin/mv" +found=no +for p in "/usr/bin/mv" "/bin/mv" "/usr/ucb/mv" "/usr/sbin/mv"; do + if test -f "$p"; then + found=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $p" >&5 +$as_echo "$p" >&6; } + cat >>confdefs.h <&5 $as_echo "not found" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bourne shell" >&5 $as_echo_n "checking for bourne shell... " >&6; } -if test -f "/bin/sh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /bin/sh" >&5 -$as_echo "/bin/sh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/bin/sh" -EOF - -elif test -f "/usr/bin/sh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/bin/sh" >&5 -$as_echo "/usr/bin/sh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/usr/bin/sh" -EOF - -elif test -f "/sbin/sh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /sbin/sh" >&5 -$as_echo "/sbin/sh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/sbin/sh" -EOF - -elif test -f "/usr/sbin/sh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/sbin/sh" >&5 -$as_echo "/usr/sbin/sh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/usr/sbin/sh" -EOF - -elif test -f "/bin/ksh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /bin/ksh" >&5 -$as_echo "/bin/ksh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/bin/ksh" -EOF - -elif test -f "/usr/bin/ksh"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/bin/ksh" >&5 -$as_echo "/usr/bin/ksh" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/usr/bin/ksh" -EOF - -elif test -f "/bin/bash"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /bin/bash" >&5 -$as_echo "/bin/bash" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/bin/bash" -EOF - -elif test -f "/usr/bin/bash"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/bin/bash" >&5 -$as_echo "/usr/bin/bash" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_BSHELL "/usr/bin/bash" +found=no +for p in "/bin/sh" "/usr/bin/sh" "/sbin/sh" "/usr/sbin/sh" "/bin/ksh" "/usr/bin/ksh" "/bin/bash" "/usr/bin/bash"; do + if test -f "$p"; then + found=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $p" >&5 +$as_echo "$p" >&6; } + cat >>confdefs.h <&5 $as_echo "not found" >&6; } fi @@ -13565,49 +13508,20 @@ fi if test -z "$with_sendmail"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendmail" >&5 $as_echo_n "checking for sendmail... " >&6; } -if test -f "/usr/sbin/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/sbin/sendmail" >&5 -$as_echo "/usr/sbin/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/sbin/sendmail" -EOF - -elif test -f "/usr/lib/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/lib/sendmail" >&5 -$as_echo "/usr/lib/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/lib/sendmail" -EOF - -elif test -f "/usr/etc/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/etc/sendmail" >&5 -$as_echo "/usr/etc/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/etc/sendmail" -EOF - -elif test -f "/usr/ucblib/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/ucblib/sendmail" >&5 -$as_echo "/usr/ucblib/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/ucblib/sendmail" -EOF - -elif test -f "/usr/local/lib/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/local/lib/sendmail" >&5 -$as_echo "/usr/local/lib/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/local/lib/sendmail" -EOF - -elif test -f "/usr/local/bin/sendmail"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: /usr/local/bin/sendmail" >&5 -$as_echo "/usr/local/bin/sendmail" >&6; } - cat >>confdefs.h <<\EOF -#define _PATH_SUDO_SENDMAIL "/usr/local/bin/sendmail" +found=no +for p in "/usr/sbin/sendmail" "/usr/lib/sendmail" "/usr/etc/sendmail" "/usr/ucblib/sendmail" "/usr/local/lib/sendmail" "/usr/local/bin/sendmail"; do + if test -f "$p"; then + found=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $p" >&5 +$as_echo "$p" >&6; } + cat >>confdefs.h <&5 $as_echo "not found" >&6; } fi @@ -13629,7 +13543,7 @@ EOF break fi done -if test X"$found" != X"no"; then +if test X"$found" != X"yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi