=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sudo/Attic/parse.yacc,v retrieving revision 1.5 retrieving revision 1.6 diff -c -r1.5 -r1.6 *** src/usr.bin/sudo/Attic/parse.yacc 2001/09/19 10:58:07 1.5 --- src/usr.bin/sudo/Attic/parse.yacc 2002/01/03 03:49:16 1.6 *************** *** 1,6 **** %{ /* ! * Copyright (c) 1996, 1998-2000 Todd C. Miller * All rights reserved. * * This code is derived from software contributed by Chris Jepeway --- 1,6 ---- %{ /* ! * Copyright (c) 1996, 1998-2001 Todd C. Miller * All rights reserved. * * This code is derived from software contributed by Chris Jepeway *************** *** 45,74 **** */ #include "config.h" #include #ifdef STDC_HEADERS ! #include #endif /* STDC_HEADERS */ #ifdef HAVE_UNISTD_H ! #include #endif /* HAVE_UNISTD_H */ #include - #include - #include - #ifdef HAVE_STRING_H - #include - #endif /* HAVE_STRING_H */ - #ifdef HAVE_STRINGS_H - #include - #endif /* HAVE_STRINGS_H */ #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__ */ #ifdef HAVE_LSEARCH ! #include #endif /* HAVE_LSEARCH */ #include "sudo.h" --- 45,81 ---- */ #include "config.h" + + #include + #include #include #ifdef STDC_HEADERS ! # include ! # include ! #else ! # ifdef HAVE_STDLIB_H ! # include ! # endif #endif /* STDC_HEADERS */ + #ifdef HAVE_STRING_H + # include + #else + # ifdef HAVE_STRINGS_H + # include + # endif + #endif /* HAVE_STRING_H */ #ifdef HAVE_UNISTD_H ! # 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__ */ #ifdef HAVE_LSEARCH ! # include #endif /* HAVE_LSEARCH */ #include "sudo.h" *************** *** 79,85 **** #endif /* HAVE_LSEARCH */ #ifndef lint ! static const char rcsid[] = "$Sudo: parse.yacc,v 1.173 2000/03/24 23:58:58 millert Exp $"; #endif /* lint */ /* --- 86,92 ---- #endif /* HAVE_LSEARCH */ #ifndef lint ! static const char rcsid[] = "$Sudo: parse.yacc,v 1.179 2001/12/30 18:41:12 millert Exp $"; #endif /* lint */ /* *************** *** 91,96 **** --- 98,104 ---- int printmatches = FALSE; int pedantic = FALSE; int keepall = FALSE; + int quiet = FALSE; /* * Alias types *************** *** 192,198 **** /* Save the line the first error occurred on. */ if (errorlineno == -1) errorlineno = sudolineno ? sudolineno - 1 : 0; ! if (s) { #ifndef TRACELEXER (void) fprintf(stderr, ">>> sudoers file: %s, line %d <<<\n", s, sudolineno ? sudolineno - 1 : 0); --- 200,206 ---- /* Save the line the first error occurred on. */ if (errorlineno == -1) errorlineno = sudolineno ? sudolineno - 1 : 0; ! if (s && !quiet) { #ifndef TRACELEXER (void) fprintf(stderr, ">>> sudoers file: %s, line %d <<<\n", s, sudolineno ? sudolineno - 1 : 0); *************** *** 214,219 **** --- 222,228 ---- %start file /* special start symbol */ %token COMMAND /* absolute pathname w/ optional args */ %token ALIAS /* an UPPERCASE alias name */ + %token DEFVAR /* a Defaults variable name */ %token NTWKADDR /* w.x.y.z */ %token NETGROUP /* a netgroup (+NAME) */ %token USERGROUP /* a usergroup (%NAME) */ *************** *** 230,236 **** %token CMNDALIAS /* Cmnd_Alias keyword */ %token USERALIAS /* User_Alias keyword */ %token RUNASALIAS /* Runas_Alias keyword */ ! %token ':' '=' ',' '!' /* union member tokens */ %token ERROR /* --- 239,245 ---- %token CMNDALIAS /* Cmnd_Alias keyword */ %token USERALIAS /* User_Alias keyword */ %token RUNASALIAS /* Runas_Alias keyword */ ! %token ':' '=' ',' '!' '+' '-' /* union member tokens */ %token ERROR /* *************** *** 290,321 **** defaults_list : defaults_entry | defaults_entry ',' defaults_list ! defaults_entry : WORD { if (defaults_matches == TRUE && ! !set_default($1, NULL, 1)) { yyerror(NULL); YYERROR; } free($1); } ! | '!' WORD { if (defaults_matches == TRUE && ! !set_default($2, NULL, 0)) { yyerror(NULL); YYERROR; } free($2); } ! | WORD '=' WORD { ! /* XXX - need to support quoted values */ if (defaults_matches == TRUE && ! !set_default($1, $3, 1)) { yyerror(NULL); YYERROR; } free($1); free($3); } privileges : privilege | privileges ':' privilege --- 299,347 ---- defaults_list : defaults_entry | defaults_entry ',' defaults_list ! defaults_entry : DEFVAR { if (defaults_matches == TRUE && ! !set_default($1, NULL, TRUE)) { yyerror(NULL); YYERROR; } free($1); } ! | '!' DEFVAR { if (defaults_matches == TRUE && ! !set_default($2, NULL, FALSE)) { yyerror(NULL); YYERROR; } free($2); } ! | DEFVAR '=' WORD { if (defaults_matches == TRUE && ! !set_default($1, $3, TRUE)) { yyerror(NULL); YYERROR; } free($1); free($3); } + | DEFVAR '+' WORD { + if (defaults_matches == TRUE && + !set_default($1, $3, '+')) { + yyerror(NULL); + YYERROR; + } + free($1); + free($3); + } + | DEFVAR '-' WORD { + if (defaults_matches == TRUE && + !set_default($1, $3, '-')) { + yyerror(NULL); + YYERROR; + } + free($1); + free($3); + } privileges : privilege | privileges ':' privilege *************** *** 463,469 **** */ if (runas_matches == -1) runas_matches = (strcmp(*user_runas, ! def_str(I_RUNAS_DEF)) == 0); } | RUNAS runaslist { runas_matches = ($2 == TRUE ? TRUE : FALSE); --- 489,495 ---- */ if (runas_matches == -1) runas_matches = (strcmp(*user_runas, ! def_str(I_RUNAS_DEFAULT)) == 0); } | RUNAS runaslist { runas_matches = ($2 == TRUE ? TRUE : FALSE); *************** *** 1002,1008 **** } while ((p = strtok(NULL, ", "))); (void) fputs(") ", stdout); } else { ! (void) printf("(%s) ", def_str(I_RUNAS_DEF)); } /* Is a password required? */ --- 1028,1034 ---- } while ((p = strtok(NULL, ", "))); (void) fputs(") ", stdout); } else { ! (void) printf("(%s) ", def_str(I_RUNAS_DEFAULT)); } /* Is a password required? */