This patch will upgrade Sudo version 1.7.10 to Sudo version 1.7.10 patchlevel 1. To apply: $ cd sudo-1.7.10 $ patch -p1 < sudo-1.7.10p1.patch diff -urNa sudo-1.7.10/ChangeLog sudo-1.7.10p1/ChangeLog --- sudo-1.7.10/ChangeLog Sat Sep 1 18:49:33 2012 +++ sudo-1.7.10p1/ChangeLog Wed Sep 12 15:34:39 2012 @@ -1,8 +1,42 @@ +2012-09-12 Todd C. Miller + + * .hgtags: + Added tag SUDO_1_7_10p1 for changeset a8330024abe7 + [857744bf2454] [tip] <1.7> + + * NEWS: + Mention support for SUCCESS=return in /etc/nsswitch.conf + [a8330024abe7] [SUDO_1_7_10p1] <1.7> + + * NEWS, configure, configure.in: + sudo 1.7.10p1 + [989cdb5456e5] <1.7> + +2012-09-11 Todd C. Miller + + * env.c: + Avoid setting LOGNAME, USER and USERNAME variables twice when + set_logname is enabled. + [7b7b0cc40a58] <1.7> + + * env.c: + Fix duplicate detection in sudo_putenv(), do not prune out the + variable we just set when overwriting an existing instance. Fixes + bug #570 + [aff4b88c72a7] <1.7> + +2012-09-04 Todd C. Miller + + * sudo.c, sudo_nss.c: + Add support for [SUCCESS=return] in nsswitch.conf; from Daniel + Kopecek + [c2a107a882b9] <1.7> + 2012-09-01 Todd C. Miller * .hgtags: Added tag SUDO_1_7_10 for changeset 56db3dcb76c6 - [54fb06201d0c] [tip] <1.7> + [54fb06201d0c] <1.7> * NEWS: mention PIE diff -urNa sudo-1.7.10/NEWS sudo-1.7.10p1/NEWS --- sudo-1.7.10/NEWS Thu Aug 30 13:55:06 2012 +++ sudo-1.7.10p1/NEWS Wed Sep 12 15:12:29 2012 @@ -1,3 +1,11 @@ +What's new in Sudo 1.7.10p1? + + * Fixed the setting of LOGNAME, USER and USERNAME variables in the + command's environment when env_reset is enabled (the default). + This was a regression introduced in version 1.7.10. + + * Sudo now honors SUCCESS=return in /etc/nsswitch.conf. + What's new in Sudo 1.7.10? * Sudo is now built with the -fstack-protector flag if the the diff -urNa sudo-1.7.10/configure sudo-1.7.10p1/configure --- sudo-1.7.10/configure Sat Sep 1 13:10:30 2012 +++ sudo-1.7.10p1/configure Wed Sep 12 14:12:36 2012 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for sudo 1.7.10. +# Generated by GNU Autoconf 2.68 for sudo 1.7.10p1. # # Report bugs to . # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='sudo' PACKAGE_TARNAME='sudo' -PACKAGE_VERSION='1.7.10' -PACKAGE_STRING='sudo 1.7.10' +PACKAGE_VERSION='1.7.10p1' +PACKAGE_STRING='sudo 1.7.10p1' PACKAGE_BUGREPORT='http://www.sudo.ws/bugs/' PACKAGE_URL='' @@ -1445,7 +1445,7 @@ # 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.10 to adapt to many kinds of systems. +\`configure' configures sudo 1.7.10p1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1510,7 +1510,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sudo 1.7.10:";; + short | recursive ) echo "Configuration of sudo 1.7.10p1:";; esac cat <<\_ACEOF @@ -1735,7 +1735,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sudo configure 1.7.10 +sudo configure 1.7.10p1 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2439,7 +2439,7 @@ 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.10, which was +It was created by sudo $as_me 1.7.10p1, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -20747,7 +20747,7 @@ # 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.10, which was +This file was extended by sudo $as_me 1.7.10p1, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20813,7 +20813,7 @@ 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.10 +sudo config.status 1.7.10p1 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -urNa sudo-1.7.10/configure.in sudo-1.7.10p1/configure.in --- sudo-1.7.10/configure.in Sat Sep 1 13:10:31 2012 +++ sudo-1.7.10p1/configure.in Wed Sep 12 14:12:14 2012 @@ -3,7 +3,7 @@ dnl dnl Copyright (c) 1994-1996,1998-2012 Todd C. Miller dnl -AC_INIT([sudo], [1.7.10], [http://www.sudo.ws/bugs/], [sudo]) +AC_INIT([sudo], [1.7.10p1], [http://www.sudo.ws/bugs/], [sudo]) AC_CONFIG_HEADER(config.h pathnames.h zlib/zconf.h) dnl dnl Note: this must come after AC_INIT diff -urNa sudo-1.7.10/env.c sudo-1.7.10p1/env.c --- sudo-1.7.10/env.c Tue Aug 7 14:27:34 2012 +++ sudo-1.7.10p1/env.c Tue Sep 11 10:26:11 2012 @@ -497,15 +497,14 @@ break; } } - /* Prune out duplicate variables. */ + /* Prune out extra instances of the variable we just overwrote. */ if (found && overwrite) { - while (*ep != NULL) { + while (*++ep != NULL) { if (strncmp(str, *ep, len) == 0) { char **cur = ep; while ((*cur = *(cur + 1)) != NULL) cur++; - } else { - ep++; + ep--; } } env.env_len = ep - env.envp; @@ -776,12 +775,15 @@ } else { if (!ISSET(didvar, DID_SHELL)) sudo_setenv("SHELL", sudo_user.pw->pw_shell, FALSE); - if (!ISSET(didvar, DID_LOGNAME)) - sudo_setenv("LOGNAME", user_name, FALSE); - if (!ISSET(didvar, DID_USER)) - sudo_setenv("USER", user_name, FALSE); - if (!ISSET(didvar, DID_USERNAME)) - sudo_setenv("USERNAME", user_name, FALSE); + /* We will set LOGNAME later in the !def_set_logname case. */ + if (!def_set_logname) { + if (!ISSET(didvar, DID_LOGNAME)) + sudo_setenv("LOGNAME", user_name, FALSE); + if (!ISSET(didvar, DID_USER)) + sudo_setenv("USER", user_name, FALSE); + if (!ISSET(didvar, DID_USERNAME)) + sudo_setenv("USERNAME", user_name, FALSE); + } } /* If we didn't keep HOME, reset it based on target user. */ @@ -842,8 +844,8 @@ /* * Set $USER, $LOGNAME and $USERNAME to target if "set_logname" is not * disabled. We skip this if we are running a login shell (because - * they have already been set them) or sudoedit (because we want the - * editor to find the user's startup files). + * they have already been set) or sudoedit (because we want the editor + * to find the invoking user's startup files). */ if (def_set_logname && !ISSET(sudo_mode, MODE_LOGIN_SHELL|MODE_EDIT)) { if (!ISSET(didvar, KEPT_LOGNAME)) diff -urNa sudo-1.7.10/sudo.c sudo-1.7.10p1/sudo.c --- sudo-1.7.10/sudo.c Wed Aug 22 12:46:37 2012 +++ sudo-1.7.10p1/sudo.c Tue Sep 4 09:27:32 2012 @@ -376,7 +376,7 @@ validated = nss->lookup(nss, validated, pwflag); if (ISSET(validated, VALIDATE_OK)) { - /* Handle "= auth" in netsvc.conf */ + /* Handle [SUCCESS=return] */ if (nss->ret_if_found) break; } else { diff -urNa sudo-1.7.10/sudo_nss.c sudo-1.7.10p1/sudo_nss.c --- sudo-1.7.10/sudo_nss.c Mon Jun 4 09:19:34 2012 +++ sudo-1.7.10p1/sudo_nss.c Tue Sep 4 09:28:18 2012 @@ -87,6 +87,10 @@ /* NOTFOUND affects the most recent entry */ tq_last(&snl)->ret_if_notfound = TRUE; got_match = FALSE; + } else if (strcasecmp(cp, "[SUCCESS=return]") == 0 && got_match) { + /* SUCCESS affects the most recent entry */ + tq_last(&snl)->ret_if_found = TRUE; + got_match = FALSE; } else got_match = FALSE; }