This patch will upgrade Sudo version 1.8.6 patchlevel 5 to Sudo version 1.8.6 patchlevel 6. To apply: $ cd sudo-1.8.6p5 $ patch -p1 < sudo-1.8.6p6.patch diff -urNa sudo-1.8.6p5/ChangeLog sudo-1.8.6p6/ChangeLog --- sudo-1.8.6p5/ChangeLog Thu Jan 24 10:05:07 2013 +++ sudo-1.8.6p6/ChangeLog Thu Jan 31 16:13:11 2013 @@ -1,3 +1,20 @@ +2013-01-31 Todd C. Miller + + * NEWS: + Clarify ttyname changes. + [9963ed81732d] + + * NEWS: + Add 1.8.6p6 + [162ea7fae117] + + * src/ttyname.c: + Remove ttyname() fall back code on systems where we can query the + kernel for the tty device via /proc or sysctl(). If there is no + controlling tty, it is better to just treat the tty as unknown + rather than to blindly use what is hooked up to std{in,out,err}. + [2f3225a2a4a4] + 2013-01-24 Todd C. Miller * plugins/sudoers/iolog.c: diff -urNa sudo-1.8.6p5/NEWS sudo-1.8.6p6/NEWS --- sudo-1.8.6p5/NEWS Thu Jan 24 07:44:55 2013 +++ sudo-1.8.6p6/NEWS Thu Jan 31 16:07:25 2013 @@ -1,3 +1,10 @@ +What's new in Sudo 1.8.6p6? + + * On systems where the controlling tty can be determined via /proc + or sysctl(), sudo will no longer fall back to using ttyname() + if the process has no controlling tty. This prevents sudo from + using a non-controlling tty for logging and time stamp purposes. + What's new in Sudo 1.8.6p5? * Fixed a potential crash in visudo's alias cycle detection. diff -urNa sudo-1.8.6p5/configure sudo-1.8.6p6/configure --- sudo-1.8.6p5/configure Thu Jan 24 07:45:21 2013 +++ sudo-1.8.6p6/configure Thu Jan 31 16:07:43 2013 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for sudo 1.8.6p5. +# Generated by GNU Autoconf 2.68 for sudo 1.8.6p6. # # Report bugs to . # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='sudo' PACKAGE_TARNAME='sudo' -PACKAGE_VERSION='1.8.6p5' -PACKAGE_STRING='sudo 1.8.6p5' +PACKAGE_VERSION='1.8.6p6' +PACKAGE_STRING='sudo 1.8.6p6' PACKAGE_BUGREPORT='http://www.sudo.ws/bugs/' PACKAGE_URL='' @@ -1470,7 +1470,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.8.6p5 to adapt to many kinds of systems. +\`configure' configures sudo 1.8.6p6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1535,7 +1535,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sudo 1.8.6p5:";; + short | recursive ) echo "Configuration of sudo 1.8.6p6:";; esac cat <<\_ACEOF @@ -1761,7 +1761,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sudo configure 1.8.6p5 +sudo configure 1.8.6p6 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2465,7 +2465,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.8.6p5, which was +It was created by sudo $as_me 1.8.6p6, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -21596,7 +21596,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.8.6p5, which was +This file was extended by sudo $as_me 1.8.6p6, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -21662,7 +21662,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.8.6p5 +sudo config.status 1.8.6p6 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -urNa sudo-1.8.6p5/configure.in sudo-1.8.6p6/configure.in --- sudo-1.8.6p5/configure.in Thu Jan 24 07:45:14 2013 +++ sudo-1.8.6p6/configure.in Thu Jan 31 16:07:32 2013 @@ -3,7 +3,7 @@ dnl dnl Copyright (c) 1994-1996,1998-2013 Todd C. Miller dnl -AC_INIT([sudo], [1.8.6p5], [http://www.sudo.ws/bugs/], [sudo]) +AC_INIT([sudo], [1.8.6p6], [http://www.sudo.ws/bugs/], [sudo]) AC_CONFIG_HEADER([config.h pathnames.h]) dnl dnl Note: this must come after AC_INIT diff -urNa sudo-1.8.6p5/src/ttyname.c sudo-1.8.6p6/src/ttyname.c --- sudo-1.8.6p5/src/ttyname.c Tue Sep 18 09:56:30 2012 +++ sudo-1.8.6p6/src/ttyname.c Thu Jan 31 11:08:19 2013 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012 Todd C. Miller + * Copyright (c) 2012-2013 Todd C. Miller * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -377,14 +377,6 @@ } efree(ki_proc); - /* If all else fails, fall back on ttyname(). */ - if (tty == NULL) { - if ((tty = ttyname(STDIN_FILENO)) != NULL || - (tty = ttyname(STDOUT_FILENO)) != NULL || - (tty = ttyname(STDERR_FILENO)) != NULL) - tty = estrdup(tty); - } - debug_return_str(tty); } #elif defined(HAVE_STRUCT_PSINFO_PR_TTYDEV) @@ -416,14 +408,6 @@ } } - /* If all else fails, fall back on ttyname(). */ - if (tty == NULL) { - if ((tty = ttyname(STDIN_FILENO)) != NULL || - (tty = ttyname(STDOUT_FILENO)) != NULL || - (tty = ttyname(STDERR_FILENO)) != NULL) - tty = estrdup(tty); - } - debug_return_str(tty); } #elif defined(__linux__) @@ -442,7 +426,7 @@ int i; debug_decl(get_process_ttyname, SUDO_DEBUG_UTIL) - /* Try to determine the tty from pr_ttydev in /proc/pid/psinfo. */ + /* Try to determine the tty from tty_nr in /proc/pid/stat. */ for (i = 0; tty == NULL && i < 2; i++) { FILE *fp; char path[PATH_MAX]; @@ -469,14 +453,6 @@ } } efree(line); - - /* If all else fails, fall back on ttyname(). */ - if (tty == NULL) { - if ((tty = ttyname(STDIN_FILENO)) != NULL || - (tty = ttyname(STDOUT_FILENO)) != NULL || - (tty = ttyname(STDERR_FILENO)) != NULL) - tty = estrdup(tty); - } debug_return_str(tty); }