From d96842b3b08ddb3a3528c7ea8a791ef6a59fb38b Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Wed, 14 May 2008 12:03:58 -0600 Subject: [PATCH] Imported Upstream version 1.6.9p8 --- CHANGES | 18 +++++ Makefile.in | 4 +- TROUBLESHOOTING | 2 +- config.h.in | 3 + configure | 85 ++++++++++++++++++--- configure.in | 28 +++---- interfaces.c | 16 ++-- interfaces.h | 6 +- parse.c | 22 +++--- parse.yacc | 7 +- sudo.cat | 18 ++--- sudo.man.in | 4 +- sudo.tab.c | 196 ++++++++++++++++++++++++------------------------ sudoers.cat | 48 ++++++------ sudoers.man.in | 4 +- testsudoers.c | 22 +++--- tgetpass.c | 63 ++++++++++------ version.h | 4 +- visudo.cat | 6 +- visudo.man.in | 4 +- 20 files changed, 325 insertions(+), 235 deletions(-) diff --git a/CHANGES b/CHANGES index 74810ac..a3797a3 100644 --- a/CHANGES +++ b/CHANGES @@ -1975,3 +1975,21 @@ Sudo 1.6.9p5 released. 624) inttypes.h is now included when appropriate if it is present. 625) Simplified alias allocation in the parser. + +Sudo 1.6.9p6 released. + +626) Go back to using TCSAFLUSH instead of TCSADRAIN when turning + off echo in tgetpass(). + +627) Fixed addition of -lutil for logincap on FreeBSD and NetBSD. + +628) Add configure check for struct in6_addr since some systems define + AF_INET6 but have no real IPv6 support. + +Sudo 1.6.9p7 released. + +629) Fixed a bug where a sudoers entry with no runas user specified + was treated differently from a line with the default runas + user specified. + +Sudo 1.6.9p8 released. diff --git a/Makefile.in b/Makefile.in index 3b47966..caa2fc5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -20,7 +20,7 @@ # # @configure_input@ # -# $Sudo: Makefile.in,v 1.246.2.16 2007/10/09 13:29:20 millert Exp $ +# $Sudo: Makefile.in,v 1.246.2.18 2007/11/02 19:15:16 millert Exp $ # #### Start of system configuration section. #### @@ -131,7 +131,7 @@ TESTOBJS = interfaces.o testsudoers.o $(PARSEOBJS) LIBOBJS = @LIBOBJS@ @ALLOCA@ -VERSION = 1.6.9p6 +VERSION = 1.6.9p8 DISTFILES = $(SRCS) $(HDRS) BUGS CHANGES HISTORY INSTALL INSTALL.configure \ LICENSE Makefile.in PORTING README README.LDAP \ diff --git a/TROUBLESHOOTING b/TROUBLESHOOTING index 5af41c5..4bf571b 100644 --- a/TROUBLESHOOTING +++ b/TROUBLESHOOTING @@ -162,7 +162,7 @@ A) Some SVR4-derived OS's include a /usr/bin/cd command for reasons unfathomable. A "cd" command is totally useless since a child process cannot affect the current working directory of the parent (your shell). -Q) When I run sudo it says I am not alllowed to run the command as root +Q) When I run sudo it says I am not allowed to run the command as root but I don't want to run it as root, I want to run it as another user. My sudoers file entry looks like: bob ALL=(oracle) ALL diff --git a/config.h.in b/config.h.in index 8e4af59..a800420 100644 --- a/config.h.in +++ b/config.h.in @@ -171,6 +171,9 @@ /* Define to 1 if your Kerberos is Heimdal. */ #undef HAVE_HEIMDAL +/* Define to 1 if contains struct in6_addr. */ +#undef HAVE_IN6_ADDR + /* Define to 1 if you have the `initgroups' function. */ #undef HAVE_INITGROUPS diff --git a/configure b/configure index b691ec4..14fc1ed 100755 --- a/configure +++ b/configure @@ -13674,6 +13674,11 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF + case "$OS" in + freebsd|netbsd) SUDO_LIBS="${SUDO_LIBS} -lutil" + ;; + esac + fi done @@ -14068,10 +14073,8 @@ cat >>conftest.$ac_ext <<_ACEOF #include #if TIME_WITH_SYS_TIME # include -# include -#else -# include #endif +#include typedef struct timespec ac__type_new_; int @@ -14121,6 +14124,73 @@ _ACEOF fi +{ echo "$as_me:$LINENO: checking for struct in6_addr" >&5 +echo $ECHO_N "checking for struct in6_addr... $ECHO_C" >&6; } +if test "${ac_cv_type_struct_in6_addr+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. */ +#include +#include + +typedef struct in6_addr ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +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_compile") 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_objext; then + ac_cv_type_struct_in6_addr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_struct_in6_addr=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_struct_in6_addr" >&5 +echo "${ECHO_T}$ac_cv_type_struct_in6_addr" >&6; } +if test $ac_cv_type_struct_in6_addr = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STRUCT_IN6_ADDR 1 +_ACEOF + +cat >>confdefs.h <<\_ACEOF +#define HAVE_IN6_ADDR 1 +_ACEOF + +fi + { echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${sudo_cv_type_size_t+set}" = set; then @@ -20535,13 +20605,6 @@ done LIBS="$_LIBS" fi -if test ${with_logincap-'no'} = "yes"; then - case "$OS" in - freebsd|netbsd) SUDO_LIBS="${SUDO_LIBS} -lutil" - ;; - esac -fi - if test ${with_AFS-'no'} = "yes"; then # looks like the "standard" place for AFS libs is /usr/afsws/lib @@ -23381,6 +23444,8 @@ fi + + diff --git a/configure.in b/configure.in index 1ff46fa..196f8a0 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl dnl Process this file with GNU autoconf to produce a configure script. -dnl $Sudo: configure.in,v 1.413.2.24 2007/10/09 00:06:05 millert Exp $ +dnl $Sudo: configure.in,v 1.413.2.27 2007/10/24 16:43:25 millert Exp $ dnl dnl Copyright (c) 1994-1996,1998-2007 Todd C. Miller dnl @@ -1632,7 +1632,12 @@ if test "$OS" != "ultrix"; then fi fi if test ${with_logincap-'no'} != "no"; then - AC_CHECK_HEADERS(login_cap.h) + AC_CHECK_HEADERS(login_cap.h, [ + case "$OS" in + freebsd|netbsd) SUDO_LIBS="${SUDO_LIBS} -lutil" + ;; + esac + ]) fi if test ${with_project-'no'} != "no"; then AC_CHECK_HEADER(project.h, AC_DEFINE(HAVE_PROJECT_H) @@ -1650,10 +1655,10 @@ AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T)], [], [#include #if TIME_WITH_SYS_TIME # include -# include -#else -# include -#endif]) +#endif +#include ]) +AC_CHECK_TYPES([struct in6_addr], [AC_DEFINE(HAVE_IN6_ADDR)], [], [#include +#include ]) SUDO_TYPE_SIZE_T SUDO_TYPE_SSIZE_T SUDO_TYPE_DEV_T @@ -2059,16 +2064,6 @@ if test ${with_kerb5-'no'} != "no" -a -z "$KRB5CONFIG"; then LIBS="$_LIBS" fi -dnl -dnl Some systems put login_cap(3) in libutil -dnl -if test ${with_logincap-'no'} = "yes"; then - case "$OS" in - freebsd|netbsd) SUDO_LIBS="${SUDO_LIBS} -lutil" - ;; - esac -fi - dnl dnl extra AFS libs and includes dnl @@ -2411,6 +2406,7 @@ AH_TEMPLATE(HAVE_GETPWANAM, [Define to 1 if you have the `getpwanam' function. ( AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR4-style shadow passwords)]) AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)]) AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.]) +AH_TEMPLATE(HAVE_IN6_ADDR, [Define to 1 if contains struct in6_addr.]) AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)]) AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)]) AH_TEMPLATE(HAVE_KERB4, [Define to 1 if you use Kerberos IV.]) diff --git a/interfaces.c b/interfaces.c index b3dc14e..f03acc0 100644 --- a/interfaces.c +++ b/interfaces.c @@ -89,7 +89,7 @@ struct rtentry; #include "interfaces.h" #ifndef lint -__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.72.2.6 2007/08/14 15:19:25 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: interfaces.c,v 1.72.2.7 2007/10/24 16:43:26 millert Exp $"; #endif /* lint */ @@ -104,7 +104,7 @@ load_interfaces() { struct ifaddrs *ifa, *ifaddrs; struct sockaddr_in *sin; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct sockaddr_in6 *sin6; #endif int i; @@ -121,7 +121,7 @@ load_interfaces() switch(ifa->ifa_addr->sa_family) { case AF_INET: -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: #endif num_interfaces++; @@ -151,7 +151,7 @@ load_interfaces() interfaces[i].family = AF_INET; i++; break; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; memcpy(&interfaces[i].addr, &sin6->sin6_addr, @@ -162,7 +162,7 @@ load_interfaces() interfaces[i].family = AF_INET6; i++; break; -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } #ifdef HAVE_FREEIFADDRS @@ -325,7 +325,7 @@ void dump_interfaces() { int i; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR char addrbuf[INET6_ADDRSTRLEN], maskbuf[INET6_ADDRSTRLEN]; #endif @@ -336,7 +336,7 @@ dump_interfaces() printf("\t%s / ", inet_ntoa(interfaces[i].addr.ip4)); puts(inet_ntoa(interfaces[i].netmask.ip4)); break; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: inet_ntop(AF_INET6, &interfaces[i].addr.ip6, addrbuf, sizeof(addrbuf)); @@ -344,7 +344,7 @@ dump_interfaces() maskbuf, sizeof(maskbuf)); printf("\t%s / %s\n", addrbuf, maskbuf); break; -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } } diff --git a/interfaces.h b/interfaces.h index de4af00..ddb6f84 100644 --- a/interfaces.h +++ b/interfaces.h @@ -17,7 +17,7 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. * - * $Sudo: interfaces.h,v 1.8.2.2 2007/08/13 16:30:02 millert Exp $ + * $Sudo: interfaces.h,v 1.8.2.3 2007/10/24 16:43:27 millert Exp $ */ #ifndef _SUDO_INTERFACES_H @@ -30,13 +30,13 @@ struct interface { int family; /* AF_INET or AF_INET6 */ union { struct in_addr ip4; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr ip6; #endif } addr; union { struct in_addr ip4; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr ip6; #endif } netmask; diff --git a/parse.c b/parse.c index 7e31ff3..68e1979 100644 --- a/parse.c +++ b/parse.c @@ -90,7 +90,7 @@ #endif /* HAVE_EXTENDED_GLOB */ #ifndef lint -__unused static const char rcsid[] = "$Sudo: parse.c,v 1.160.2.13 2007/08/25 02:37:11 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: parse.c,v 1.160.2.14 2007/10/24 16:43:27 millert Exp $"; #endif /* lint */ /* @@ -390,13 +390,13 @@ addr_matches_if(n) int i; struct in_addr addr; struct interface *ifp; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr addr6; int j; #endif int family; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR if (inet_pton(AF_INET6, n, &addr6) > 0) { family = AF_INET6; } else @@ -417,7 +417,7 @@ addr_matches_if(n) == addr.s_addr) return(TRUE); break; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: if (memcmp(ifp->addr.ip6.s6_addr, addr6.s6_addr, sizeof(addr6.s6_addr)) == 0) @@ -428,7 +428,7 @@ addr_matches_if(n) } if (j == sizeof(addr6.s6_addr)) return(TRUE); -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } @@ -443,13 +443,13 @@ addr_matches_if_netmask(n, m) int i; struct in_addr addr, mask; struct interface *ifp; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr addr6, mask6; int j; #endif int family; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR if (inet_pton(AF_INET6, n, &addr6) > 0) family = AF_INET6; else @@ -470,7 +470,7 @@ addr_matches_if_netmask(n, m) mask.s_addr = htonl(mask.s_addr); } } -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR else { if (inet_pton(AF_INET6, m, &mask6) <= 0) { j = atoi(m); @@ -484,7 +484,7 @@ addr_matches_if_netmask(n, m) } } } -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ for (i = 0; i < num_interfaces; i++) { ifp = &interfaces[i]; @@ -494,7 +494,7 @@ addr_matches_if_netmask(n, m) case AF_INET: if ((ifp->addr.ip4.s_addr & mask.s_addr) == addr.s_addr) return(TRUE); -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: for (j = 0; j < sizeof(addr6.s6_addr); j++) { if ((ifp->addr.ip6.s6_addr[j] & mask6.s6_addr[j]) != addr6.s6_addr[j]) @@ -502,7 +502,7 @@ addr_matches_if_netmask(n, m) } if (j == sizeof(addr6.s6_addr)) return(TRUE); -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } diff --git a/parse.yacc b/parse.yacc index de81caf..7684fb8 100644 --- a/parse.yacc +++ b/parse.yacc @@ -69,7 +69,7 @@ #endif /* HAVE_LSEARCH */ #ifndef lint -__unused static const char rcsid[] = "$Sudo: parse.yacc,v 1.204.2.7 2007/09/13 23:06:51 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: parse.yacc,v 1.204.2.8 2007/11/02 19:09:01 millert Exp $"; #endif /* lint */ /* @@ -505,9 +505,8 @@ runasspec : /* empty */ { * then check against default runas user. */ if (runas_matches == UNSPEC) { - runas_matches = - userpw_matches(def_runas_default, - *user_runas, runas_pw); + runas_matches = userpw_matches(def_runas_default, + *user_runas, runas_pw) ? TRUE : NOMATCH; } } | RUNAS runaslist { diff --git a/sudo.cat b/sudo.cat index 2fc0933..036f360 100644 --- a/sudo.cat +++ b/sudo.cat @@ -61,7 +61,7 @@ DDEESSCCRRIIPPTTIIOONN -1.6.9p6 October 9, 2007 1 +1.6.9p8 November 2, 2007 1 @@ -127,7 +127,7 @@ OOPPTTIIOONNSS -1.6.9p6 October 9, 2007 2 +1.6.9p8 November 2, 2007 2 @@ -193,7 +193,7 @@ SUDO(1m) MAINTENANCE COMMANDS SUDO(1m) -1.6.9p6 October 9, 2007 3 +1.6.9p8 November 2, 2007 3 @@ -259,7 +259,7 @@ SUDO(1m) MAINTENANCE COMMANDS SUDO(1m) -1.6.9p6 October 9, 2007 4 +1.6.9p8 November 2, 2007 4 @@ -325,7 +325,7 @@ SSEECCUURRIITTYY NNOOTTEESS -1.6.9p6 October 9, 2007 5 +1.6.9p8 November 2, 2007 5 @@ -391,7 +391,7 @@ SUDO(1m) MAINTENANCE COMMANDS SUDO(1m) -1.6.9p6 October 9, 2007 6 +1.6.9p8 November 2, 2007 6 @@ -457,7 +457,7 @@ EEXXAAMMPPLLEESS -1.6.9p6 October 9, 2007 7 +1.6.9p8 November 2, 2007 7 @@ -523,7 +523,7 @@ CCAAVVEEAATTSS -1.6.9p6 October 9, 2007 8 +1.6.9p8 November 2, 2007 8 @@ -589,6 +589,6 @@ DDIISSCCLLAAIIMMEERR -1.6.9p6 October 9, 2007 9 +1.6.9p8 November 2, 2007 9 diff --git a/sudo.man.in b/sudo.man.in index 1ccfabf..48c9b16 100644 --- a/sudo.man.in +++ b/sudo.man.in @@ -18,7 +18,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.\" $Sudo: sudo.man.in,v 1.29.2.13 2007/10/09 13:30:47 millert Exp $ +.\" $Sudo: sudo.man.in,v 1.29.2.15 2007/11/02 19:15:16 millert Exp $ .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: @@ -150,7 +150,7 @@ .\" ======================================================================== .\" .IX Title "SUDO @mansectsu@" -.TH SUDO @mansectsu@ "October 9, 2007" "1.6.9p6" "MAINTENANCE COMMANDS" +.TH SUDO @mansectsu@ "November 2, 2007" "1.6.9p8" "MAINTENANCE COMMANDS" .SH "NAME" sudo, sudoedit \- execute a command as another user .SH "SYNOPSIS" diff --git a/sudo.tab.c b/sudo.tab.c index 6740c72..1d4b9b7 100644 --- a/sudo.tab.c +++ b/sudo.tab.c @@ -4,7 +4,7 @@ static char yyrcsid[] #if __GNUC__ >= 2 __attribute__ ((unused)) #endif /* __GNUC__ >= 2 */ - = "$OpenBSD: skeleton.c,v 1.26 2006/04/20 16:51:32 deraadt Exp $"; + = "$OpenBSD: skeleton.c,v 1.28 2007/09/03 21:14:58 deraadt Exp $"; #endif #include #define YYBYACC 1 @@ -72,9 +72,6 @@ static char yyrcsid[] # include #endif /* HAVE_UNISTD_H */ #include -#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS) -# include -#endif /* HAVE_MALLOC_H && !STDC_HEADERS */ #if defined(YYBISON) && defined(HAVE_ALLOCA_H) && !defined(__GNUC__) # include #endif /* YYBISON && HAVE_ALLOCA_H && !__GNUC__ */ @@ -90,7 +87,7 @@ static char yyrcsid[] #endif /* HAVE_LSEARCH */ #ifndef lint -__unused static const char rcsid[] = "$Sudo: sudo.tab.c,v 1.76.2.6 2007/08/13 16:30:47 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: sudo.tab.c,v 1.76.2.7 2007/11/02 19:09:22 millert Exp $"; #endif /* lint */ /* @@ -216,7 +213,7 @@ static void append __P((char *, char **, size_t *, size_t *, char *)); static void expand_ga_list __P((void)); static void expand_match_list __P((void)); static aliasinfo *find_alias __P((char *, int)); -static int more_aliases __P((void)); +static void more_aliases __P((void)); void init_parser __P((void)); void yyerror __P((char *)); @@ -237,7 +234,7 @@ yyerror(s) } parse_error = TRUE; } -#line 224 "parse.yacc" +#line 221 "parse.yacc" #ifndef YYSTYPE_DEFINED #define YYSTYPE_DEFINED typedef union { @@ -247,7 +244,7 @@ typedef union { int tok; } YYSTYPE; #endif /* YYSTYPE_DEFINED */ -#line 251 "sudo.tab.c" +#line 248 "sudo.tab.c" #define COMMAND 257 #define ALIAS 258 #define DEFVAR 259 @@ -674,7 +671,7 @@ short *yyss; short *yysslim; YYSTYPE *yyvs; int yystacksize; -#line 909 "parse.yacc" +#line 905 "parse.yacc" #define MOREALIASES (32) aliasinfo *aliases = NULL; @@ -733,12 +730,8 @@ add_alias(alias, type, val) size_t onaliases; char s[512]; - if (naliases >= nslots && !more_aliases()) { - (void) snprintf(s, sizeof(s), "Out of memory defining alias `%s'", - alias); - yyerror(s); - return(FALSE); - } + if (naliases >= nslots) + more_aliases(); ai.type = type; ai.val = val; @@ -782,17 +775,12 @@ find_alias(alias, type) /* * Allocates more space for the aliases list. */ -static int +static void more_aliases() { nslots += MOREALIASES; - if (nslots == MOREALIASES) - aliases = (aliasinfo *) malloc(nslots * sizeof(aliasinfo)); - else - aliases = (aliasinfo *) realloc(aliases, nslots * sizeof(aliasinfo)); - - return(aliases != NULL); + aliases = (aliasinfo *) erealloc3(aliases, nslots, sizeof(aliasinfo)); } /* @@ -1039,7 +1027,7 @@ init_parser() if (printmatches == TRUE) expand_match_list(); } -#line 991 "sudo.tab.c" +#line 979 "sudo.tab.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ #if defined(__cplusplus) || defined(__STDC__) static int yygrowstack(void) @@ -1058,14 +1046,23 @@ static int yygrowstack() else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; i = yyssp - yyss; +#ifdef SIZE_MAX +#define YY_SIZE_MAX SIZE_MAX +#else +#define YY_SIZE_MAX 0xffffffffU +#endif + if (newsize && YY_SIZE_MAX / newsize < sizeof *newss) + goto bail; newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) : - (short *)malloc(newsize * sizeof *newss); + (short *)malloc(newsize * sizeof *newss); /* overflow check above */ if (newss == NULL) goto bail; yyss = newss; yyssp = newss + i; + if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs) + goto bail; newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) : - (YYSTYPE *)malloc(newsize * sizeof *newvs); + (YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */ if (newvs == NULL) goto bail; yyvs = newvs; @@ -1233,85 +1230,85 @@ yyreduce: switch (yyn) { case 3: -#line 280 "parse.yacc" +#line 277 "parse.yacc" { ; } break; case 4: -#line 282 "parse.yacc" +#line 279 "parse.yacc" { yyerrok; } break; case 5: -#line 283 "parse.yacc" +#line 280 "parse.yacc" { push; } break; case 6: -#line 283 "parse.yacc" +#line 280 "parse.yacc" { while (top && user_matches != TRUE) pop; } break; case 7: -#line 288 "parse.yacc" +#line 285 "parse.yacc" { ; } break; case 8: -#line 290 "parse.yacc" +#line 287 "parse.yacc" { ; } break; case 9: -#line 292 "parse.yacc" +#line 289 "parse.yacc" { ; } break; case 10: -#line 294 "parse.yacc" +#line 291 "parse.yacc" { ; } break; case 11: -#line 296 "parse.yacc" +#line 293 "parse.yacc" { ; } break; case 13: -#line 302 "parse.yacc" +#line 299 "parse.yacc" { defaults_matches = TRUE; } break; case 14: -#line 305 "parse.yacc" +#line 302 "parse.yacc" { push; } break; case 15: -#line 305 "parse.yacc" +#line 302 "parse.yacc" { defaults_matches = user_matches; pop; } break; case 16: -#line 309 "parse.yacc" +#line 306 "parse.yacc" { push; } break; case 17: -#line 309 "parse.yacc" +#line 306 "parse.yacc" { defaults_matches = yyvsp[0].BOOLEAN == TRUE; pop; } break; case 18: -#line 313 "parse.yacc" +#line 310 "parse.yacc" { push; } break; case 19: -#line 313 "parse.yacc" +#line 310 "parse.yacc" { defaults_matches = host_matches; pop; } break; case 22: -#line 323 "parse.yacc" +#line 320 "parse.yacc" { if (defaults_matches == TRUE && !set_default(yyvsp[0].string, NULL, TRUE)) { @@ -1322,7 +1319,7 @@ case 22: } break; case 23: -#line 331 "parse.yacc" +#line 328 "parse.yacc" { if (defaults_matches == TRUE && !set_default(yyvsp[0].string, NULL, FALSE)) { @@ -1333,7 +1330,7 @@ case 23: } break; case 24: -#line 339 "parse.yacc" +#line 336 "parse.yacc" { if (defaults_matches == TRUE && !set_default(yyvsp[-2].string, yyvsp[0].string, TRUE)) { @@ -1345,7 +1342,7 @@ case 24: } break; case 25: -#line 348 "parse.yacc" +#line 345 "parse.yacc" { if (defaults_matches == TRUE && !set_default(yyvsp[-2].string, yyvsp[0].string, '+')) { @@ -1357,7 +1354,7 @@ case 25: } break; case 26: -#line 357 "parse.yacc" +#line 354 "parse.yacc" { if (defaults_matches == TRUE && !set_default(yyvsp[-2].string, yyvsp[0].string, '-')) { @@ -1369,7 +1366,7 @@ case 26: } break; case 29: -#line 372 "parse.yacc" +#line 369 "parse.yacc" { /* * We already did a push if necessary in @@ -1384,25 +1381,25 @@ case 29: } break; case 30: -#line 386 "parse.yacc" +#line 383 "parse.yacc" { SETMATCH(host_matches, yyvsp[0].BOOLEAN); } break; case 31: -#line 389 "parse.yacc" +#line 386 "parse.yacc" { SETNMATCH(host_matches, yyvsp[0].BOOLEAN); } break; case 32: -#line 394 "parse.yacc" +#line 391 "parse.yacc" { yyval.BOOLEAN = TRUE; } break; case 33: -#line 397 "parse.yacc" +#line 394 "parse.yacc" { if (addr_matches(yyvsp[0].string)) yyval.BOOLEAN = TRUE; @@ -1412,7 +1409,7 @@ case 33: } break; case 34: -#line 404 "parse.yacc" +#line 401 "parse.yacc" { if (netgr_matches(yyvsp[0].string, user_host, user_shost, NULL)) yyval.BOOLEAN = TRUE; @@ -1422,7 +1419,7 @@ case 34: } break; case 35: -#line 411 "parse.yacc" +#line 408 "parse.yacc" { if (hostname_matches(user_shost, user_host, yyvsp[0].string) == 0) yyval.BOOLEAN = TRUE; @@ -1432,7 +1429,7 @@ case 35: } break; case 36: -#line 418 "parse.yacc" +#line 415 "parse.yacc" { aliasinfo *aip = find_alias(yyvsp[0].string, HOST_ALIAS); @@ -1457,7 +1454,7 @@ case 36: } break; case 39: -#line 446 "parse.yacc" +#line 443 "parse.yacc" { /* * Push the entry onto the stack if it is worth @@ -1487,13 +1484,13 @@ case 39: } break; case 40: -#line 475 "parse.yacc" +#line 472 "parse.yacc" { SETMATCH(cmnd_matches, yyvsp[0].BOOLEAN); } break; case 41: -#line 478 "parse.yacc" +#line 475 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1505,13 +1502,13 @@ case 41: } break; case 42: -#line 486 "parse.yacc" +#line 483 "parse.yacc" { SETNMATCH(cmnd_matches, yyvsp[0].BOOLEAN); } break; case 43: -#line 491 "parse.yacc" +#line 488 "parse.yacc" { if (printmatches == TRUE && host_matches == TRUE && user_matches == TRUE) { @@ -1532,24 +1529,23 @@ case 43: * then check against default runas user. */ if (runas_matches == UNSPEC) { - runas_matches = - userpw_matches(def_runas_default, - *user_runas, runas_pw); + runas_matches = userpw_matches(def_runas_default, + *user_runas, runas_pw) ? TRUE : NOMATCH; } } break; case 44: -#line 516 "parse.yacc" +#line 512 "parse.yacc" { runas_matches = yyvsp[0].BOOLEAN; } break; case 45: -#line 521 "parse.yacc" +#line 517 "parse.yacc" { ; } break; case 46: -#line 522 "parse.yacc" +#line 518 "parse.yacc" { /* Later entries override earlier ones. */ if (yyvsp[0].BOOLEAN != NOMATCH) @@ -1559,11 +1555,11 @@ case 46: } break; case 47: -#line 531 "parse.yacc" +#line 527 "parse.yacc" { ; } break; case 48: -#line 532 "parse.yacc" +#line 528 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1575,14 +1571,14 @@ case 48: } break; case 49: -#line 540 "parse.yacc" +#line 536 "parse.yacc" { /* Set $$ to the negation of runasuser */ yyval.BOOLEAN = (yyvsp[0].BOOLEAN == NOMATCH ? NOMATCH : ! yyvsp[0].BOOLEAN); } break; case 50: -#line 546 "parse.yacc" +#line 542 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1600,7 +1596,7 @@ case 50: } break; case 51: -#line 561 "parse.yacc" +#line 557 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1618,7 +1614,7 @@ case 51: } break; case 52: -#line 576 "parse.yacc" +#line 572 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1636,7 +1632,7 @@ case 52: } break; case 53: -#line 591 "parse.yacc" +#line 587 "parse.yacc" { aliasinfo *aip = find_alias(yyvsp[0].string, RUNAS_ALIAS); @@ -1669,7 +1665,7 @@ case 53: } break; case 54: -#line 621 "parse.yacc" +#line 617 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1682,7 +1678,7 @@ case 54: } break; case 55: -#line 633 "parse.yacc" +#line 629 "parse.yacc" { /* Inherit {NO,}{PASSWD,EXEC,SETENV} status. */ if (printmatches == TRUE && host_matches == TRUE && @@ -1703,7 +1699,7 @@ case 55: } break; case 56: -#line 651 "parse.yacc" +#line 647 "parse.yacc" { no_passwd = TRUE; if (printmatches == TRUE && host_matches == TRUE && @@ -1712,7 +1708,7 @@ case 56: } break; case 57: -#line 657 "parse.yacc" +#line 653 "parse.yacc" { no_passwd = FALSE; if (printmatches == TRUE && host_matches == TRUE && @@ -1721,7 +1717,7 @@ case 57: } break; case 58: -#line 663 "parse.yacc" +#line 659 "parse.yacc" { no_execve = TRUE; if (printmatches == TRUE && host_matches == TRUE && @@ -1730,7 +1726,7 @@ case 58: } break; case 59: -#line 669 "parse.yacc" +#line 665 "parse.yacc" { no_execve = FALSE; if (printmatches == TRUE && host_matches == TRUE && @@ -1739,7 +1735,7 @@ case 59: } break; case 60: -#line 675 "parse.yacc" +#line 671 "parse.yacc" { setenv_ok = TRUE; if (printmatches == TRUE && host_matches == TRUE && @@ -1748,7 +1744,7 @@ case 60: } break; case 61: -#line 681 "parse.yacc" +#line 677 "parse.yacc" { setenv_ok = FALSE; if (printmatches == TRUE && host_matches == TRUE && @@ -1757,7 +1753,7 @@ case 61: } break; case 62: -#line 689 "parse.yacc" +#line 685 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) @@ -1775,7 +1771,7 @@ case 62: } break; case 63: -#line 704 "parse.yacc" +#line 700 "parse.yacc" { aliasinfo *aip; @@ -1807,7 +1803,7 @@ case 63: } break; case 64: -#line 733 "parse.yacc" +#line 729 "parse.yacc" { if (printmatches == TRUE) { if (in_alias == TRUE) { @@ -1834,11 +1830,11 @@ case 64: } break; case 67: -#line 763 "parse.yacc" +#line 759 "parse.yacc" { push; } break; case 68: -#line 763 "parse.yacc" +#line 759 "parse.yacc" { if ((MATCHED(host_matches) || pedantic) && !add_alias(yyvsp[-3].string, HOST_ALIAS, host_matches)) { @@ -1849,7 +1845,7 @@ case 68: } break; case 73: -#line 781 "parse.yacc" +#line 777 "parse.yacc" { push; if (printmatches == TRUE) { @@ -1862,7 +1858,7 @@ case 73: } break; case 74: -#line 790 "parse.yacc" +#line 786 "parse.yacc" { if ((MATCHED(cmnd_matches) || pedantic) && !add_alias(yyvsp[-3].string, CMND_ALIAS, cmnd_matches)) { @@ -1877,11 +1873,11 @@ case 74: } break; case 75: -#line 804 "parse.yacc" +#line 800 "parse.yacc" { ; } break; case 79: -#line 812 "parse.yacc" +#line 808 "parse.yacc" { if (printmatches == TRUE) { in_alias = TRUE; @@ -1893,7 +1889,7 @@ case 79: } break; case 80: -#line 820 "parse.yacc" +#line 816 "parse.yacc" { if ((yyvsp[0].BOOLEAN != NOMATCH || pedantic) && !add_alias(yyvsp[-3].string, RUNAS_ALIAS, yyvsp[0].BOOLEAN)) { @@ -1907,11 +1903,11 @@ case 80: } break; case 83: -#line 837 "parse.yacc" +#line 833 "parse.yacc" { push; } break; case 84: -#line 837 "parse.yacc" +#line 833 "parse.yacc" { if ((MATCHED(user_matches) || pedantic) && !add_alias(yyvsp[-3].string, USER_ALIAS, user_matches)) { @@ -1923,19 +1919,19 @@ case 84: } break; case 87: -#line 852 "parse.yacc" +#line 848 "parse.yacc" { SETMATCH(user_matches, yyvsp[0].BOOLEAN); } break; case 88: -#line 855 "parse.yacc" +#line 851 "parse.yacc" { SETNMATCH(user_matches, yyvsp[0].BOOLEAN); } break; case 89: -#line 860 "parse.yacc" +#line 856 "parse.yacc" { if (userpw_matches(yyvsp[0].string, user_name, sudo_user.pw)) yyval.BOOLEAN = TRUE; @@ -1945,7 +1941,7 @@ case 89: } break; case 90: -#line 867 "parse.yacc" +#line 863 "parse.yacc" { if (usergr_matches(yyvsp[0].string, user_name, sudo_user.pw)) yyval.BOOLEAN = TRUE; @@ -1955,7 +1951,7 @@ case 90: } break; case 91: -#line 874 "parse.yacc" +#line 870 "parse.yacc" { if (netgr_matches(yyvsp[0].string, NULL, NULL, user_name)) yyval.BOOLEAN = TRUE; @@ -1965,7 +1961,7 @@ case 91: } break; case 92: -#line 881 "parse.yacc" +#line 877 "parse.yacc" { aliasinfo *aip = find_alias(yyvsp[0].string, USER_ALIAS); @@ -1990,12 +1986,12 @@ case 92: } break; case 93: -#line 903 "parse.yacc" +#line 899 "parse.yacc" { yyval.BOOLEAN = TRUE; } break; -#line 1947 "sudo.tab.c" +#line 1943 "sudo.tab.c" } yyssp -= yym; yystate = *yyssp; diff --git a/sudoers.cat b/sudoers.cat index dbda5ba..044b2aa 100644 --- a/sudoers.cat +++ b/sudoers.cat @@ -61,7 +61,7 @@ DDEESSCCRRIIPPTTIIOONN -1.6.9p6 October 9, 2007 1 +1.6.9p8 November 2, 2007 1 @@ -127,7 +127,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 2 +1.6.9p8 November 2, 2007 2 @@ -193,7 +193,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 3 +1.6.9p8 November 2, 2007 3 @@ -259,7 +259,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 4 +1.6.9p8 November 2, 2007 4 @@ -325,7 +325,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 5 +1.6.9p8 November 2, 2007 5 @@ -391,7 +391,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 6 +1.6.9p8 November 2, 2007 6 @@ -457,7 +457,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 7 +1.6.9p8 November 2, 2007 7 @@ -523,7 +523,7 @@ SSUUDDOOEERRSS OOPPTTIIOONNSS -1.6.9p6 October 9, 2007 8 +1.6.9p8 November 2, 2007 8 @@ -589,7 +589,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 9 +1.6.9p8 November 2, 2007 9 @@ -655,7 +655,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 10 +1.6.9p8 November 2, 2007 10 @@ -721,7 +721,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 11 +1.6.9p8 November 2, 2007 11 @@ -787,7 +787,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 12 +1.6.9p8 November 2, 2007 12 @@ -853,7 +853,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 13 +1.6.9p8 November 2, 2007 13 @@ -919,7 +919,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 14 +1.6.9p8 November 2, 2007 14 @@ -985,7 +985,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 15 +1.6.9p8 November 2, 2007 15 @@ -1051,7 +1051,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 16 +1.6.9p8 November 2, 2007 16 @@ -1117,7 +1117,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 17 +1.6.9p8 November 2, 2007 17 @@ -1183,7 +1183,7 @@ EEXXAAMMPPLLEESS -1.6.9p6 October 9, 2007 18 +1.6.9p8 November 2, 2007 18 @@ -1249,7 +1249,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 19 +1.6.9p8 November 2, 2007 19 @@ -1315,7 +1315,7 @@ SUDOERS(4) MAINTENANCE COMMANDS SUDOERS(4) -1.6.9p6 October 9, 2007 20 +1.6.9p8 November 2, 2007 20 @@ -1381,7 +1381,7 @@ SSEECCUURRIITTYY NNOOTTEESS -1.6.9p6 October 9, 2007 21 +1.6.9p8 November 2, 2007 21 @@ -1447,7 +1447,7 @@ PPRREEVVEENNTTIINNGG SSHHEELLLL EESSCCAAPPEESS -1.6.9p6 October 9, 2007 22 +1.6.9p8 November 2, 2007 22 @@ -1513,7 +1513,7 @@ SSUUPPPPOORRTT -1.6.9p6 October 9, 2007 23 +1.6.9p8 November 2, 2007 23 @@ -1579,6 +1579,6 @@ DDIISSCCLLAAIIMMEERR -1.6.9p6 October 9, 2007 24 +1.6.9p8 November 2, 2007 24 diff --git a/sudoers.man.in b/sudoers.man.in index 9b2d7c0..7d7f733 100644 --- a/sudoers.man.in +++ b/sudoers.man.in @@ -18,7 +18,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.\" $Sudo: sudoers.man.in,v 1.45.2.15 2007/10/09 13:30:47 millert Exp $ +.\" $Sudo: sudoers.man.in,v 1.45.2.17 2007/11/02 19:15:16 millert Exp $ .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: @@ -150,7 +150,7 @@ .\" ======================================================================== .\" .IX Title "SUDOERS @mansectform@" -.TH SUDOERS @mansectform@ "October 9, 2007" "1.6.9p6" "MAINTENANCE COMMANDS" +.TH SUDOERS @mansectform@ "November 2, 2007" "1.6.9p8" "MAINTENANCE COMMANDS" .SH "NAME" sudoers \- list of which users may execute what .SH "DESCRIPTION" diff --git a/testsudoers.c b/testsudoers.c index dd9953f..756d331 100644 --- a/testsudoers.c +++ b/testsudoers.c @@ -75,7 +75,7 @@ #endif /* HAVE_FNMATCH */ #ifndef lint -__unused static const char rcsid[] = "$Sudo: testsudoers.c,v 1.88.2.5 2007/08/25 02:45:09 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: testsudoers.c,v 1.88.2.6 2007/10/24 16:43:27 millert Exp $"; #endif /* lint */ @@ -180,13 +180,13 @@ addr_matches_if(n) int i; struct in_addr addr; struct interface *ifp; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr addr6; int j; #endif int family; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR if (inet_pton(AF_INET6, n, &addr6) > 0) { family = AF_INET6; } else @@ -207,7 +207,7 @@ addr_matches_if(n) == addr.s_addr) return(TRUE); break; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: if (memcmp(ifp->addr.ip6.s6_addr, addr6.s6_addr, sizeof(addr6.s6_addr)) == 0) @@ -218,7 +218,7 @@ addr_matches_if(n) } if (j == sizeof(addr6.s6_addr)) return(TRUE); -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } @@ -233,13 +233,13 @@ addr_matches_if_netmask(n, m) int i; struct in_addr addr, mask; struct interface *ifp; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR struct in6_addr addr6, mask6; int j; #endif int family; -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR if (inet_pton(AF_INET6, n, &addr6) > 0) family = AF_INET6; else @@ -260,7 +260,7 @@ addr_matches_if_netmask(n, m) mask.s_addr = htonl(mask.s_addr); } } -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR else { if (inet_pton(AF_INET6, m, &mask6) <= 0) { j = atoi(m); @@ -274,7 +274,7 @@ addr_matches_if_netmask(n, m) } } } -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ for (i = 0; i < num_interfaces; i++) { ifp = &interfaces[i]; @@ -284,7 +284,7 @@ addr_matches_if_netmask(n, m) case AF_INET: if ((ifp->addr.ip4.s_addr & mask.s_addr) == addr.s_addr) return(TRUE); -#ifdef AF_INET6 +#ifdef HAVE_IN6_ADDR case AF_INET6: for (j = 0; j < sizeof(addr6.s6_addr); j++) { if ((ifp->addr.ip6.s6_addr[j] & mask6.s6_addr[j]) != addr6.s6_addr[j]) @@ -292,7 +292,7 @@ addr_matches_if_netmask(n, m) } if (j == sizeof(addr6.s6_addr)) return(TRUE); -#endif /* AF_INET6 */ +#endif /* HAVE_IN6_ADDR */ } } diff --git a/tgetpass.c b/tgetpass.c index 6e356cd..c008c15 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -70,7 +70,7 @@ #include "sudo.h" #ifndef lint -__unused static const char rcsid[] = "$Sudo: tgetpass.c,v 1.111.2.4 2007/10/08 16:01:10 millert Exp $"; +__unused static const char rcsid[] = "$Sudo: tgetpass.c,v 1.111.2.5 2007/10/17 15:39:43 millert Exp $"; #endif /* lint */ #ifndef TCSASOFT @@ -89,26 +89,36 @@ __unused static const char rcsid[] = "$Sudo: tgetpass.c,v 1.111.2.4 2007/10/08 1 #endif /* - * Abstract method of getting at the term flags. + * QNX 6 (at least) has issues with TCSAFLUSH. */ -#undef TERM -#undef tflags -#ifdef HAVE_TERMIOS_H -# define TERM termios -# define tflags c_lflag -# define term_getattr(f, t) tcgetattr(f, t) -# define term_setattr(f, t) tcsetattr(f, TCSADRAIN|TCSASOFT, t) -#else +#ifdef __QNX__ +#undef TCSAFLUSH +#define TCSAFLUSH TCSADRAIN +#endif + +/* + * Compat macros for non-termios systems. + */ +#ifndef HAVE_TERMIOS_H # ifdef HAVE_TERMIO_H -# define TERM termio -# define tflags c_lflag -# define term_getattr(f, t) ioctl(f, TCGETA, t) -# define term_setattr(f, t) ioctl(f, TCSETAF, t) +# undef termios +# define termios termio +# define tcgetattr(f, t) ioctl(f, TCGETA, t) +# define tcsetattr(f, a, t) ioctl(f, a, t) +# undef TCSAFLUSH +# define TCSAFLUSH TCSETAF +# undef TCSANOW +# define TCSANOW TCSETA # else -# define TERM sgttyb -# define tflags sg_flags -# define term_getattr(f, t) ioctl(f, TIOCGETP, t) -# define term_setattr(f, t) ioctl(f, TIOCSETP, t) +# undef termios +# define termios sgttyb +# define c_lflag sg_flags +# define tcgetattr(f, t) ioctl(f, TIOCGETP, t) +# define tcsetattr(f, a, t) ioctl(f, a, t) +# undef TCSAFLUSH +# define TCSAFLUSH TIOCSETP +# undef TCSANOW +# define TCSANOW TIOCSETN # endif /* HAVE_TERMIO_H */ #endif /* HAVE_TERMIOS_H */ @@ -128,7 +138,7 @@ tgetpass(prompt, timeout, flags) { sigaction_t sa, savealrm, saveint, savehup, savequit, saveterm; sigaction_t savetstp, savettin, savettou; - struct TERM term, oterm; + struct termios term, oterm; char *pass; static char buf[SUDO_PASS_MAX + 1]; int input, output, save_errno; @@ -162,14 +172,14 @@ restart: (void) sigaction(SIGTTOU, &sa, &savettou); /* Turn echo off/on as specified by flags. */ - if (term_getattr(input, &oterm) == 0) { + if (tcgetattr(input, &oterm) == 0) { (void) memcpy(&term, &oterm, sizeof(term)); if (!ISSET(flags, TGP_ECHO)) - CLR(term.tflags, (ECHO | ECHONL)); + CLR(term.c_lflag, ECHO|ECHONL); #ifdef VSTATUS term.c_cc[VSTATUS] = _POSIX_VDISABLE; #endif - (void) term_setattr(input, &term); + (void) tcsetattr(input, TCSAFLUSH|TCSASOFT, &term); } else { memset(&term, 0, sizeof(term)); memset(&oterm, 0, sizeof(oterm)); @@ -186,13 +196,16 @@ restart: alarm(0); save_errno = errno; - if (!ISSET(term.tflags, ECHO)) + if (!ISSET(term.c_lflag, ECHO)) (void) write(output, "\n", 1); } /* Restore old tty settings and signals. */ - if (memcmp(&term, &oterm, sizeof(term)) != 0) - (void) term_setattr(input, &oterm); + if (memcmp(&term, &oterm, sizeof(term)) != 0) { + while (tcsetattr(input, TCSANOW|TCSASOFT, &oterm) == -1 && + errno == EINTR) + continue; + } (void) sigaction(SIGALRM, &savealrm, NULL); (void) sigaction(SIGINT, &saveint, NULL); (void) sigaction(SIGHUP, &savehup, NULL); diff --git a/version.h b/version.h index 0d55e99..4a95e86 100644 --- a/version.h +++ b/version.h @@ -17,12 +17,12 @@ * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. * - * $Sudo: version.h,v 1.66.2.9 2007/10/09 13:29:20 millert Exp $ + * $Sudo: version.h,v 1.66.2.11 2007/11/02 19:15:16 millert Exp $ */ #ifndef _SUDO_VERSION_H #define _SUDO_VERSION_H -static const char version[] = "1.6.9p6"; +static const char version[] = "1.6.9p8"; #endif /* _SUDO_VERSION_H */ diff --git a/visudo.cat b/visudo.cat index 79b1e60..1a0be5c 100644 --- a/visudo.cat +++ b/visudo.cat @@ -61,7 +61,7 @@ OOPPTTIIOONNSS -1.6.9p6 October 9, 2007 1 +1.6.9p8 November 2, 2007 1 @@ -127,7 +127,7 @@ DDIIAAGGNNOOSSTTIICCSS -1.6.9p6 October 9, 2007 2 +1.6.9p8 November 2, 2007 2 @@ -193,6 +193,6 @@ DDIISSCCLLAAIIMMEERR -1.6.9p6 October 9, 2007 3 +1.6.9p8 November 2, 2007 3 diff --git a/visudo.man.in b/visudo.man.in index 6caf2e7..fe412a2 100644 --- a/visudo.man.in +++ b/visudo.man.in @@ -17,7 +17,7 @@ .\" Agency (DARPA) and Air Force Research Laboratory, Air Force .\" Materiel Command, USAF, under agreement number F39502-99-1-0512. .\" -.\" $Sudo: visudo.man.in,v 1.20.2.11 2007/10/09 13:30:48 millert Exp $ +.\" $Sudo: visudo.man.in,v 1.20.2.13 2007/11/02 19:15:16 millert Exp $ .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: @@ -149,7 +149,7 @@ .\" ======================================================================== .\" .IX Title "VISUDO @mansectsu@" -.TH VISUDO @mansectsu@ "October 9, 2007" "1.6.9p6" "MAINTENANCE COMMANDS" +.TH VISUDO @mansectsu@ "November 2, 2007" "1.6.9p8" "MAINTENANCE COMMANDS" .SH "NAME" visudo \- edit the sudoers file .SH "SYNOPSIS" -- 2.47.2