summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/sudo/ChangeLog89
-rw-r--r--usr.bin/sudo/Makefile.in2
-rw-r--r--usr.bin/sudo/auth/kerb5.c3
-rw-r--r--usr.bin/sudo/auth/pam.c17
-rw-r--r--usr.bin/sudo/config.h6
-rw-r--r--usr.bin/sudo/configure165
-rw-r--r--usr.bin/sudo/configure.in41
-rw-r--r--usr.bin/sudo/match.c14
-rw-r--r--usr.bin/sudo/mkdefaults4
-rw-r--r--usr.bin/sudo/sudo.c17
-rw-r--r--usr.bin/sudo/sudo.pod5
-rw-r--r--usr.bin/sudo/sudo_edit.c28
-rw-r--r--usr.bin/sudo/sudoers.pod2
-rw-r--r--usr.bin/sudo/toke.l18
14 files changed, 309 insertions, 102 deletions
diff --git a/usr.bin/sudo/ChangeLog b/usr.bin/sudo/ChangeLog
index 15e7d2e0c59..8a5a0aaf2d5 100644
--- a/usr.bin/sudo/ChangeLog
+++ b/usr.bin/sudo/ChangeLog
@@ -1,3 +1,92 @@
+2009-11-23 10:56 millert
+
+ * match.c: cmnd_matches() already deals with negation so
+ _cmndlist_matches() does not need to do so itself. Fixes a bug
+ with negated entries in a Cmnd_List.
+
+2009-11-22 11:12 millert
+
+ * sudo.c: Don't exit() from open_sudoers, just return NULL for all
+ errors.
+
+2009-11-22 09:54 millert
+
+ * toke.c, toke.l: Add missing extern def for parse_error
+
+2009-11-20 19:11 millert
+
+ * toke.c, toke.l: Avoid a parse error when #includedir doesn't find
+ any files. Closes bug #375
+
+2009-11-20 19:03 millert
+
+ * Makefile.in: Include sudo.man.pl and sudoers.man.pl in the
+ distribution tarball.
+
+2009-11-04 09:42 millert
+
+ * configure, configure.in: Fix a few typos in the descriptions;
+ from Jeff Makey Only do the check for
+ krb5_get_init_creds_opt_free() taking two arguments if we find
+ krb5_get_init_creds_opt_alloc(). Otherwise we will get a false
+ positive when using our own krb5_get_init_creds_opt_free which
+ takes only a single argument.
+
+2009-11-03 09:58 millert
+
+ * configure, configure.in: Remove a spurious comma in the kerb5
+ bits.
+
+2009-11-03 09:51 millert
+
+ * auth/kerb5.c: Call krb5_get_init_creds_opt_init() in our emulated
+ krb5_get_init_creds_opt_alloc() for MIT kerberos.
+
+2009-09-30 09:50 millert
+
+ * sudo_edit.c: Always update the stashed mtime of the temp file
+ instead of using what we have for the original because the time
+ resolution of the filesystem the temporary is on may not match
+ that of the filesystem that holds the original. Should fix bz
+ #371 found by Philippe Levan.
+
+2009-09-24 21:11 millert
+
+ * configure, configure.in, sudoers.man.pl, sudoers.pod: Substitute
+ in default value for secure_path
+
+2009-09-24 20:31 millert
+
+ * sudo.pod: Mention that the password must be followed by a newline
+ with the -S option.
+
+2009-08-07 10:21 millert
+
+ * auth/pam.c: Set PAM_RUSER and PAM_RHOST early so they can be used
+ during authentication. Based on a patch from Jamie Beverly.
+
+2009-08-07 09:25 millert
+
+ * match.c: Close dir before returning if strlcpy() reports
+ overflow. From Martynas Venckus.
+
+2009-07-18 09:55 millert
+
+ * toke.c, toke.l: Fix expansion of %h in #include names. Fixes
+ bugzilla 363
+
+2009-07-12 17:17 millert
+
+ * mkdefaults: If no arg assume def_data.in
+
+2009-07-11 21:27 millert
+
+ * README, WHATSNEW: Update for 1.7.2
+
+2009-07-11 21:12 millert
+
+ * ChangeLog: sync
+
2009-06-30 08:41 millert
* sudoers.cat, sudoers.man.in, sudoers.pod: Add missing single
diff --git a/usr.bin/sudo/Makefile.in b/usr.bin/sudo/Makefile.in
index c7fc8d91ef7..245e77e28a9 100644
--- a/usr.bin/sudo/Makefile.in
+++ b/usr.bin/sudo/Makefile.in
@@ -153,7 +153,7 @@ DISTFILES = $(SRCS) $(HDRS) ChangeLog HISTORY INSTALL INSTALL.configure \
sudo.man.in sudo.pod sudo.psf sudo_usage.h.in sudoers sudoers.cat \
sudoers.man.in sudoers.pod sudoers.ldap.cat sudoers.ldap.man.in \
sudoers.ldap.pod sudoers2ldif visudo.cat visudo.man.in visudo.pod \
- auth/API
+ auth/API sudo.man.pl sudoers.man.pl
BINFILES= ChangeLog HISTORY LICENSE README TROUBLESHOOTING \
UPGRADE install-sh mkinstalldirs sample.syslog.conf sample.sudoers \
diff --git a/usr.bin/sudo/auth/kerb5.c b/usr.bin/sudo/auth/kerb5.c
index 5e17685bc06..fd43950d55b 100644
--- a/usr.bin/sudo/auth/kerb5.c
+++ b/usr.bin/sudo/auth/kerb5.c
@@ -54,7 +54,7 @@
#include "sudo_auth.h"
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: kerb5.c,v 1.36 2008/11/09 14:13:13 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: kerb5.c,v 1.37 2009/11/03 14:51:20 millert Exp $";
#endif /* lint */
#ifdef HAVE_HEIMDAL
@@ -81,6 +81,7 @@ krb5_get_init_creds_opt_alloc(context, opts)
krb5_get_init_creds_opt **opts;
{
*opts = emalloc(sizeof(krb5_get_init_creds_opt));
+ krb5_get_init_creds_opt_init(*opts);
return 0;
}
diff --git a/usr.bin/sudo/auth/pam.c b/usr.bin/sudo/auth/pam.c
index 47820ba8a84..b03a1f75b12 100644
--- a/usr.bin/sudo/auth/pam.c
+++ b/usr.bin/sudo/auth/pam.c
@@ -73,7 +73,7 @@
#endif
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: pam.c,v 1.68 2009/05/25 12:02:42 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: pam.c,v 1.69 2009/08/07 14:21:51 millert Exp $";
#endif /* lint */
static int sudo_conv __P((int, PAM_CONST struct pam_message **,
@@ -105,6 +105,14 @@ pam_init(pw, promptp, auth)
log_error(USE_ERRNO|NO_EXIT|NO_MAIL, "unable to initialize PAM");
return(AUTH_FATAL);
}
+
+ /*
+ * Set PAM_RUSER to the invoking user (the "from" user).
+ * We set PAM_RHOST to avoid a bug in Solaris 7 and below.
+ */
+ (void) pam_set_item(pamh, PAM_RUSER, user_name);
+ (void) pam_set_item(pamh, PAM_RHOST, user_host);
+
/*
* Some versions of pam_lastlog have a bug that
* will cause a crash if PAM_TTY is not set so if
@@ -203,13 +211,10 @@ pam_prep_user(pw)
pam_init(pw, NULL, NULL);
/*
- * Set PAM_USER to the user we are changing *to* and
- * set PAM_RUSER to the user we are coming *from*.
- * We set PAM_RHOST to avoid a bug in Solaris 7 and below.
+ * Update PAM_USER to reference the user we are running the command
+ * as, as opposed to the user we authenticated as.
*/
(void) pam_set_item(pamh, PAM_USER, pw->pw_name);
- (void) pam_set_item(pamh, PAM_RUSER, user_name);
- (void) pam_set_item(pamh, PAM_RHOST, user_host);
/*
* Set credentials (may include resource limits, device ownership, etc).
diff --git a/usr.bin/sudo/config.h b/usr.bin/sudo/config.h
index 33c0e77703b..cf004eb35fc 100644
--- a/usr.bin/sudo/config.h
+++ b/usr.bin/sudo/config.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.h,v 1.13 2009/06/21 14:48:41 millert Exp $ */
+/* $OpenBSD: config.h,v 1.14 2009/12/07 18:43:10 millert Exp $ */
#ifndef _SUDO_CONFIG_H
#define _SUDO_CONFIG_H
@@ -10,9 +10,9 @@
#define PACKAGE_BUGREPORT "http://www.sudo.ws/bugs/"
#define PACKAGE_NAME "sudo"
-#define PACKAGE_STRING "sudo 1.7.2"
+#define PACKAGE_STRING "sudo 1.7.2p2"
#define PACKAGE_TARNAME "sudo"
-#define PACKAGE_VERSION "1.7.2"
+#define PACKAGE_VERSION "1.7.2p2"
#define HAVE_ASPRINTF 1
#define HAVE_BSD_AUTH_H 1
diff --git a/usr.bin/sudo/configure b/usr.bin/sudo/configure
index 1d45b2118a1..b9e0fddbd00 100644
--- a/usr.bin/sudo/configure
+++ b/usr.bin/sudo/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for sudo 1.7.2.
+# Generated by GNU Autoconf 2.61 for sudo 1.7.2p2.
#
# Report bugs to <http://www.sudo.ws/bugs/>.
#
@@ -724,8 +724,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='sudo'
PACKAGE_TARNAME='sudo'
-PACKAGE_VERSION='1.7.2'
-PACKAGE_STRING='sudo 1.7.2'
+PACKAGE_VERSION='1.7.2p2'
+PACKAGE_STRING='sudo 1.7.2p2'
PACKAGE_BUGREPORT='http://www.sudo.ws/bugs/'
# Factoring default headers for most tests.
@@ -869,6 +869,7 @@ ldap_conf
ldap_secret
nsswitch_conf
netsvc_conf
+secure_path
EGREPPROG
CC
ac_ct_CC
@@ -1416,7 +1417,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.2 to adapt to many kinds of systems.
+\`configure' configures sudo 1.7.2p2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1481,7 +1482,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sudo 1.7.2:";;
+ short | recursive ) echo "Configuration of sudo 1.7.2p2:";;
esac
cat <<\_ACEOF
@@ -1683,7 +1684,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sudo configure 1.7.2
+sudo configure 1.7.2p2
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1697,7 +1698,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.2, which was
+It was created by sudo $as_me 1.7.2p2, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2122,6 +2123,7 @@ echo "$as_me: Configuring Sudo version $PACKAGE_VERSION" >&6;}
+
timeout=5
password_timeout=5
sudo_umask=0022
@@ -2147,6 +2149,7 @@ tty_tickets=off
insults=off
root_sudo=on
path_info=on
+secure_path="not set"
INSTALL_NOEXEC=
devdir='$(srcdir)'
PROGS="sudo visudo"
@@ -3695,12 +3698,14 @@ echo $ECHO_N "checking whether to override the user's path... $ECHO_C" >&6; }
# Check whether --with-secure-path was given.
if test "${with_secure_path+set}" = set; then
withval=$with_secure_path; case $with_secure_path in
- yes) cat >>confdefs.h <<_ACEOF
-#define SECURE_PATH "/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
+ yes) with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
+ cat >>confdefs.h <<_ACEOF
+#define SECURE_PATH "$with_secure_path"
_ACEOF
- { echo "$as_me:$LINENO: result: :/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc" >&5
-echo "${ECHO_T}:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc" >&6; }
+ { echo "$as_me:$LINENO: result: $with_secure_path" >&5
+echo "${ECHO_T}$with_secure_path" >&6; }
+ secure_path="set to $with_secure_path"
;;
no) { echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
@@ -3711,6 +3716,7 @@ _ACEOF
{ echo "$as_me:$LINENO: result: $with_secure_path" >&5
echo "${ECHO_T}$with_secure_path" >&6; }
+ secure_path="set to F<$with_secure_path>"
;;
esac
else
@@ -6262,7 +6268,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6265 "configure"' > conftest.$ac_ext
+ echo '#line 6271 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -8126,11 +8132,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:8129: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8135: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8133: \$? = $ac_status" >&5
+ echo "$as_me:8139: \$? = $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.
@@ -8416,11 +8422,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:8419: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8425: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8423: \$? = $ac_status" >&5
+ echo "$as_me:8429: \$? = $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.
@@ -8520,11 +8526,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:8523: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8529: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8527: \$? = $ac_status" >&5
+ echo "$as_me:8533: \$? = $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
@@ -10880,7 +10886,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10883 "configure"
+#line 10889 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10980,7 +10986,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 10983 "configure"
+#line 10989 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21523,7 +21529,7 @@ fi
{ echo "$as_me:$LINENO: result: $ac_cv_lib_krb5support_main" >&5
echo "${ECHO_T}$ac_cv_lib_krb5support_main" >&6; }
if test $ac_cv_lib_krb5support_main = yes; then
- SUDO_LIBS="${SUDO_LIBS} -lkrb5support,"
+ SUDO_LIBS="${SUDO_LIBS} -lkrb5support"
fi
@@ -21535,8 +21541,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
LIBS="${LIBS} ${SUDO_LIBS}"
-
-for ac_func in krb5_verify_user krb5_init_secure_context krb5_get_init_creds_opt_alloc
+for ac_func in krb5_verify_user krb5_init_secure_context
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
@@ -21629,13 +21634,104 @@ _ACEOF
fi
done
- { echo "$as_me:$LINENO: checking whether krb5_get_init_creds_opt_free takes a two argument2" >&5
-echo $ECHO_N "checking whether krb5_get_init_creds_opt_free takes a two argument2... $ECHO_C" >&6; }
+
+for ac_func in krb5_get_init_creds_opt_alloc
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+ { echo "$as_me:$LINENO: checking whether krb5_get_init_creds_opt_free takes a context" >&5
+echo $ECHO_N "checking whether krb5_get_init_creds_opt_free takes a context... $ECHO_C" >&6; }
if test "${sudo_cv_krb5_get_init_creds_opt_free_two_args+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat >conftest.$ac_ext <<_ACEOF
+ cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
@@ -21645,11 +21741,7 @@ cat >>conftest.$ac_ext <<_ACEOF
int
main ()
{
-
- krb5_context context = NULL;
- krb5_get_init_creds_opt *opts = NULL;
- krb5_get_init_creds_opt_free(context, opts);
-
+krb5_get_init_creds_opt_free(NULL, NULL);
;
return 0;
}
@@ -21686,6 +21778,10 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $sudo_cv_krb5_get_init_creds_opt_free_two_args" >&5
echo "${ECHO_T}$sudo_cv_krb5_get_init_creds_opt_free_two_args" >&6; }
+
+fi
+done
+
if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS 1
@@ -24462,7 +24558,7 @@ exec 6>&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.2, which was
+This file was extended by sudo $as_me 1.7.2p2, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -24511,7 +24607,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-sudo config.status 1.7.2
+sudo config.status 1.7.2p2
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
@@ -24833,6 +24929,7 @@ ldap_conf!$ldap_conf$ac_delim
ldap_secret!$ldap_secret$ac_delim
nsswitch_conf!$nsswitch_conf$ac_delim
netsvc_conf!$netsvc_conf$ac_delim
+secure_path!$secure_path$ac_delim
EGREPPROG!$EGREPPROG$ac_delim
CC!$CC$ac_delim
ac_ct_CC!$ac_ct_CC$ac_delim
@@ -24868,7 +24965,7 @@ KRB5CONFIG!$KRB5CONFIG$ac_delim
LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 41; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 42; then
break
elif $ac_last_try; then
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
diff --git a/usr.bin/sudo/configure.in b/usr.bin/sudo/configure.in
index e21ad6fe7b0..f9a7d31a17f 100644
--- a/usr.bin/sudo/configure.in
+++ b/usr.bin/sudo/configure.in
@@ -4,7 +4,7 @@ dnl $Sudo: configure.in,v 1.549 2009/06/13 20:52:50 millert Exp $
dnl
dnl Copyright (c) 1994-1996,1998-2009 Todd C. Miller <Todd.Miller@courtesan.com>
dnl
-AC_INIT([sudo], [1.7.2], [http://www.sudo.ws/bugs/], [sudo])
+AC_INIT([sudo], [1.7.2p2], [http://www.sudo.ws/bugs/], [sudo])
AC_CONFIG_HEADER(config.h pathnames.h)
dnl
dnl This won't work before AC_INIT
@@ -85,6 +85,7 @@ AC_SUBST(ldap_conf)
AC_SUBST(ldap_secret)
AC_SUBST(nsswitch_conf)
AC_SUBST(netsvc_conf)
+AC_SUBST(secure_path)
dnl
dnl Initial values for above
dnl
@@ -113,6 +114,7 @@ tty_tickets=off
insults=off
root_sudo=on
path_info=on
+secure_path="not set"
INSTALL_NOEXEC=
devdir='$(srcdir)'
dnl
@@ -988,13 +990,16 @@ fi
AC_MSG_CHECKING(whether to override the user's path)
AC_ARG_WITH(secure-path, [AS_HELP_STRING([--with-secure-path], [override the user's path with a built-in one])],
[case $with_secure_path in
- yes) AC_DEFINE_UNQUOTED(SECURE_PATH, "/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc")
- AC_MSG_RESULT([:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc])
+ yes) with_secure_path="/bin:/usr/ucb:/usr/bin:/usr/sbin:/sbin:/usr/etc:/etc"
+ AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
+ AC_MSG_RESULT([$with_secure_path])
+ secure_path="set to $with_secure_path"
;;
no) AC_MSG_RESULT(no)
;;
*) AC_DEFINE_UNQUOTED(SECURE_PATH, "$with_secure_path")
AC_MSG_RESULT([$with_secure_path])
+ secure_path="set to F<$with_secure_path>"
;;
esac], AC_MSG_RESULT(no))
@@ -2234,25 +2239,23 @@ if test ${with_kerb5-'no'} != "no" -a -z "$KRB5CONFIG"; then
], [
AC_MSG_RESULT(no)
SUDO_LIBS="${SUDO_LIBS} -lkrb5 -lk5crypto -lcom_err"
- AC_CHECK_LIB(krb5support, main, [SUDO_LIBS="${SUDO_LIBS} -lkrb5support,"])
+ AC_CHECK_LIB(krb5support, main, [SUDO_LIBS="${SUDO_LIBS} -lkrb5support"])
])
AUTH_OBJS="$AUTH_OBJS kerb5.o"
_LIBS="$LIBS"
LIBS="${LIBS} ${SUDO_LIBS}"
- AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context krb5_get_init_creds_opt_alloc)
- AC_CACHE_CHECK(whether krb5_get_init_creds_opt_free takes a two argument2,
- sudo_cv_krb5_get_init_creds_opt_free_two_args, [
- AC_TRY_COMPILE([#include <krb5.h>],
- [
- krb5_context context = NULL;
- krb5_get_init_creds_opt *opts = NULL;
- krb5_get_init_creds_opt_free(context, opts);
- ],
- [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
- [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
- )
- ]
- )
+ AC_CHECK_FUNCS(krb5_verify_user krb5_init_secure_context)
+ AC_CHECK_FUNCS(krb5_get_init_creds_opt_alloc, [
+ AC_CACHE_CHECK([whether krb5_get_init_creds_opt_free takes a context],
+ sudo_cv_krb5_get_init_creds_opt_free_two_args, [
+ AC_TRY_COMPILE([#include <krb5.h>],
+ [krb5_get_init_creds_opt_free(NULL, NULL);],
+ [sudo_cv_krb5_get_init_creds_opt_free_two_args=yes],
+ [sudo_cv_krb5_get_init_creds_opt_free_two_args=no]
+ )
+ ]
+ )
+ ])
if test X"$sudo_cv_krb5_get_init_creds_opt_free_two_args" = X"yes"; then
AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS)
fi
@@ -2663,7 +2666,7 @@ AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (Su
AH_TEMPLATE(HAVE_KERB4, [Define to 1 if you use Kerberos IV.])
AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC, [Define to 1 if you have the `krb5_get_init_creds_opt_alloc' function.])
-AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS, [Define to 1 if your `krb5_get_init_creds_opt_alloc' function takes two arguments.])
+AH_TEMPLATE(HAVE_KRB5_GET_INIT_CREDS_OPT_FREE_TWO_ARGS, [Define to 1 if your `krb5_get_init_creds_opt_free' function takes two arguments.])
AH_TEMPLATE(HAVE_KRB5_INIT_SECURE_CONTEXT, [Define to 1 if you have the `krb5_init_secure_context' function.])
AH_TEMPLATE(HAVE_KRB5_VERIFY_USER, [Define to 1 if you have the `krb5_verify_user' function.])
AH_TEMPLATE(HAVE_LBER_H, [Define to 1 if your LDAP needs <lber.h>. (OpenLDAP does not)])
diff --git a/usr.bin/sudo/match.c b/usr.bin/sudo/match.c
index fd60fdbd28e..c0f917b25bb 100644
--- a/usr.bin/sudo/match.c
+++ b/usr.bin/sudo/match.c
@@ -94,7 +94,7 @@
#endif /* USING_NONUNIX_GROUPS */
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: match.c,v 1.46 2009/05/27 00:49:07 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: match.c,v 1.48 2009/11/23 15:56:14 millert Exp $";
#endif /* lint */
static struct member_list empty;
@@ -318,14 +318,12 @@ _cmndlist_matches(list)
struct member_list *list;
{
struct member *m;
- int rval, matched = UNSPEC;
+ int matched = UNSPEC;
tq_foreach_rev(list, m) {
- rval = cmnd_matches(m);
- if (rval != UNSPEC) {
- matched = m->negated ? !rval : rval;
+ matched = cmnd_matches(m);
+ if (matched != UNSPEC)
break;
- }
}
return(matched);
}
@@ -580,8 +578,10 @@ command_matches_dir(sudoers_dir, dlen)
if (dirp == NULL)
return(FALSE);
- if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf))
+ if (strlcpy(buf, sudoers_dir, sizeof(buf)) >= sizeof(buf)) {
+ closedir(dirp);
return(FALSE);
+ }
while ((dent = readdir(dirp)) != NULL) {
/* ignore paths > PATH_MAX (XXX - log) */
buf[dlen] = '\0';
diff --git a/usr.bin/sudo/mkdefaults b/usr.bin/sudo/mkdefaults
index f125e045258..2a0ba8d7cef 100644
--- a/usr.bin/sudo/mkdefaults
+++ b/usr.bin/sudo/mkdefaults
@@ -16,9 +16,9 @@ if ($#ARGV > 0 && $ARGV[0] eq "-o") {
$header .= '.h';
$cfile .= '.c';
}
-die "usage: $0 input_file\n" unless $#ARGV == 0;
+die "usage: $0 [input_file]\n" unless $#ARGV == -1 || $#ARGV == 0;
-$infile = $ARGV[0];
+$infile = $ARGV[0] || "def_data.in";
if (!defined($header)) {
$header = $infile;
$header =~ s/(\.in)?$/.h/;
diff --git a/usr.bin/sudo/sudo.c b/usr.bin/sudo/sudo.c
index 66a1121dcf1..27af77a68c4 100644
--- a/usr.bin/sudo/sudo.c
+++ b/usr.bin/sudo/sudo.c
@@ -648,7 +648,8 @@ init_vars(sudo_mode, envp)
}
}
- if ((p = ttyname(STDIN_FILENO)) || (p = ttyname(STDOUT_FILENO))) {
+ if ((p = ttyname(STDIN_FILENO)) || (p = ttyname(STDOUT_FILENO)) ||
+ (p = ttyname(STDERR_FILENO))) {
user_tty = user_ttypath = estrdup(p);
if (strncmp(user_tty, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
user_tty += sizeof(_PATH_DEV) - 1;
@@ -1139,17 +1140,21 @@ open_sudoers(sudoers, doedit, keepopen)
log_error(NO_EXIT, "%s is owned by gid %lu, should be %lu", sudoers,
(unsigned long) statbuf.st_gid, (unsigned long) SUDOERS_GID);
else if ((fp = fopen(sudoers, "r")) == NULL)
- log_error(USE_ERRNO, "can't open %s", sudoers);
+ log_error(USE_ERRNO|NO_EXIT, "can't open %s", sudoers);
else {
/*
* Make sure we can actually read sudoers so we can present the
* user with a reasonable error message (unlike the lexer).
*/
- if (statbuf.st_size != 0) {
- if (fgetc(fp) == EOF)
- log_error(USE_ERRNO, "can't read %s", sudoers);
- rewind(fp);
+ if (statbuf.st_size != 0 && fgetc(fp) == EOF) {
+ log_error(USE_ERRNO|NO_EXIT, "can't read %s", sudoers);
+ fclose(fp);
+ fp = NULL;
}
+ }
+
+ if (fp != NULL) {
+ rewind(fp);
(void) fcntl(fileno(fp), F_SETFD, 1);
}
diff --git a/usr.bin/sudo/sudo.pod b/usr.bin/sudo/sudo.pod
index a4354bfffc1..2e3b0724469 100644
--- a/usr.bin/sudo/sudo.pod
+++ b/usr.bin/sudo/sudo.pod
@@ -18,7 +18,7 @@ Sponsored in part by the Defense Advanced Research Projects
Agency (DARPA) and Air Force Research Laboratory, Air Force
Materiel Command, USAF, under agreement number F39502-99-1-0512.
-$Sudo: sudo.pod,v 1.124 2009/06/15 21:19:47 millert Exp $
+$Sudo: sudo.pod,v 1.125 2009/09/25 00:31:35 millert Exp $
=pod
=head1 NAME
@@ -331,7 +331,8 @@ I<passprompt_override> flag is disabled in I<sudoers>.
=item -S
The B<-S> (I<stdin>) option causes B<sudo> to read the password from
-the standard input instead of the terminal device.
+the standard input instead of the terminal device. The password must
+be followed by a newline character.
=item -s [command]
diff --git a/usr.bin/sudo/sudo_edit.c b/usr.bin/sudo/sudo_edit.c
index fba5a1b945c..d6a4da66a8a 100644
--- a/usr.bin/sudo/sudo_edit.c
+++ b/usr.bin/sudo/sudo_edit.c
@@ -56,7 +56,7 @@
#include "sudo.h"
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: sudo_edit.c,v 1.37 2008/11/09 14:13:12 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: sudo_edit.c,v 1.39 2009/09/30 13:50:58 millert Exp $";
#endif /* lint */
extern sigaction_t saved_sa_int, saved_sa_quit, saved_sa_tstp;
@@ -171,21 +171,23 @@ sudo_edit(argc, argv, envp)
}
close(ofd);
}
-#ifdef HAVE_FSTAT
/*
- * If we are unable to set the mtime on the temp file to the value
- * of the original file just make the stashed mtime match the temp
- * file's mtime. It is better than nothing and we only use the info
+ * We always update the stashed mtime because the time
+ * resolution of the filesystem the temporary file is on may
+ * not match that of the filesystem where the file to be edited
+ * resides. It is OK if touch() fails since we only use the info
* to determine whether or not a file has been modified.
*/
- if (touch(tfd, NULL, &tf[i].omtim) == -1) {
- if (fstat(tfd, &sb) == 0) {
- tf[i].omtim.tv_sec = mtim_getsec(sb);
- tf[i].omtim.tv_nsec = mtim_getnsec(sb);
- }
- /* XXX - else error? */
- }
+ (void) touch(tfd, NULL, &tf[i].omtim);
+#ifdef HAVE_FSTAT
+ error = fstat(tfd, &sb);
+#else
+ error = stat(tf[i].tfile, &sb);
#endif
+ if (!error) {
+ tf[i].omtim.tv_sec = mtim_getsec(sb);
+ tf[i].omtim.tv_nsec = mtim_getnsec(sb);
+ }
close(tfd);
}
if (argc == 1)
@@ -233,7 +235,7 @@ sudo_edit(argc, argv, envp)
(void) sigaction(SIGINT, &saved_sa_int, NULL);
(void) sigaction(SIGQUIT, &saved_sa_quit, NULL);
set_perms(PERM_FULL_USER);
- closefrom(def_closefrom + 1);
+ closefrom(def_closefrom);
execvp(nargv[0], nargv);
warning("unable to execute %s", nargv[0]);
_exit(127);
diff --git a/usr.bin/sudo/sudoers.pod b/usr.bin/sudo/sudoers.pod
index a55ce0e6c60..bbc2264d2bd 100644
--- a/usr.bin/sudo/sudoers.pod
+++ b/usr.bin/sudo/sudoers.pod
@@ -1166,7 +1166,7 @@ people running B<sudo> to have a sane C<PATH> environment variable you may
want to use this. Another use is if you want to have the "root path"
be separate from the "user path." Users in the group specified by the
I<exempt_group> option are not affected by I<secure_path>.
-This is not set by default.
+This option is @secure_path@ by default.
=item syslog
diff --git a/usr.bin/sudo/toke.l b/usr.bin/sudo/toke.l
index 3fbfd2c36b7..bb89a2fc800 100644
--- a/usr.bin/sudo/toke.l
+++ b/usr.bin/sudo/toke.l
@@ -72,10 +72,11 @@
#include <gram.h>
#ifndef lint
-__unused static const char rcsid[] = "$Sudo: toke.l,v 1.38 2009/07/18 13:55:37 millert Exp $";
+__unused static const char rcsid[] = "$Sudo: toke.l,v 1.40 2009/11/22 14:54:04 millert Exp $";
#endif /* lint */
extern YYSTYPE yylval;
+extern int parse_error;
int sudolineno = 1;
char *sudoers;
static int sawspace = 0;
@@ -253,8 +254,11 @@ DEFVAR [a-z_]+
LEXTRACE("INCLUDEDIR\n");
- /* Push current buffer and switch to include file */
- if (!push_includedir(path))
+ /*
+ * Push current buffer and switch to include file.
+ * We simply ignore empty directories.
+ */
+ if (!push_includedir(path) && parse_error)
yyterminate();
}
@@ -748,7 +752,7 @@ switch_dir(stack, dirpath)
if (!(dir = opendir(dirpath))) {
yyerror(dirpath);
- return(FALSE);
+ return(NULL);
}
while ((dent = readdir(dir))) {
/* Ignore files that end in '~' or have a '.' in them. */
@@ -873,12 +877,12 @@ _push_include(path, isdir)
}
if (isdir) {
if (!(path = switch_dir(&istack[idepth], path))) {
- yyerror(path);
+ /* switch_dir() called yyerror() for us */
return(FALSE);
}
if ((fp = open_sudoers(path, FALSE, &keepopen)) == NULL) {
yyerror(path);
- return(FALSE); /* XXX - just to go next one? */
+ return(FALSE); /* XXX - just to go next one */
}
} else {
if ((fp = open_sudoers(path, TRUE, &keepopen)) == NULL) {
@@ -918,7 +922,7 @@ pop_include()
istack[idepth - 1].more = pl->next;
if ((fp = open_sudoers(pl->path, FALSE, &keepopen)) == NULL) {
yyerror(pl->path);
- return(FALSE); /* XXX - just to go next one? */
+ return(FALSE); /* XXX - just to go next one */
}
efree(sudoers);
sudoers = pl->path;