2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Avoid printing the >>> parse error <<< message for testsudoers

when the -t flag is specified.
This commit is contained in:
Todd C. Miller
2012-08-23 11:28:44 -04:00
parent 793426106e
commit 0c8c3c0cd8
5 changed files with 170 additions and 170 deletions

View File

@@ -4,7 +4,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* $Header: /cvs/src/usr.bin/lex/flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $
* $Header: /home/cvs/openbsd/src/usr.bin/lex/flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $
*/
#define FLEX_SCANNER
@@ -1488,7 +1488,6 @@ static bool _push_include(char *, bool);
static bool pop_include(void);
static char *parse_include(char *);
static int sudoers_trace_print(const char *msg);
int (*trace_print)(const char *msg) = sudoers_trace_print;
#define LEXRETURN(n) do { \
@@ -1512,7 +1511,7 @@ int (*trace_print)(const char *msg) = sudoers_trace_print;
#define INSTR 5
#line 1515 "lex.yy.c"
#line 1514 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -1666,9 +1665,9 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 133 "toke.l"
#line 132 "toke.l"
#line 1671 "lex.yy.c"
#line 1670 "lex.yy.c"
if ( yy_init )
{
@@ -1754,7 +1753,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
#line 134 "toke.l"
#line 133 "toke.l"
{
LEXTRACE(", ");
LEXRETURN(',');
@@ -1762,12 +1761,12 @@ YY_RULE_SETUP
YY_BREAK
case 2:
YY_RULE_SETUP
#line 139 "toke.l"
#line 138 "toke.l"
BEGIN STARTDEFS;
YY_BREAK
case 3:
YY_RULE_SETUP
#line 141 "toke.l"
#line 140 "toke.l"
{
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
@@ -1779,7 +1778,7 @@ YY_RULE_SETUP
case 4:
YY_RULE_SETUP
#line 150 "toke.l"
#line 149 "toke.l"
{
BEGIN STARTDEFS;
LEXTRACE(", ");
@@ -1788,7 +1787,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
#line 156 "toke.l"
#line 155 "toke.l"
{
LEXTRACE("= ");
LEXRETURN('=');
@@ -1796,7 +1795,7 @@ YY_RULE_SETUP
YY_BREAK
case 6:
YY_RULE_SETUP
#line 161 "toke.l"
#line 160 "toke.l"
{
LEXTRACE("+= ");
LEXRETURN('+');
@@ -1804,7 +1803,7 @@ YY_RULE_SETUP
YY_BREAK
case 7:
YY_RULE_SETUP
#line 166 "toke.l"
#line 165 "toke.l"
{
LEXTRACE("-= ");
LEXRETURN('-');
@@ -1812,7 +1811,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 171 "toke.l"
#line 170 "toke.l"
{
LEXTRACE("BEGINSTR ");
yylval.string = NULL;
@@ -1822,7 +1821,7 @@ YY_RULE_SETUP
YY_BREAK
case 9:
YY_RULE_SETUP
#line 178 "toke.l"
#line 177 "toke.l"
{
LEXTRACE("WORD(2) ");
if (!fill(yytext, yyleng))
@@ -1834,7 +1833,7 @@ YY_RULE_SETUP
case 10:
YY_RULE_SETUP
#line 187 "toke.l"
#line 186 "toke.l"
{
/* Line continuation char followed by newline. */
sudolineno++;
@@ -1843,7 +1842,7 @@ YY_RULE_SETUP
YY_BREAK
case 11:
YY_RULE_SETUP
#line 193 "toke.l"
#line 192 "toke.l"
{
LEXTRACE("ENDSTR ");
BEGIN prev_state;
@@ -1878,7 +1877,7 @@ YY_RULE_SETUP
YY_BREAK
case 12:
YY_RULE_SETUP
#line 225 "toke.l"
#line 224 "toke.l"
{
LEXTRACE("BACKSLASH ");
if (!append(yytext, yyleng))
@@ -1887,7 +1886,7 @@ YY_RULE_SETUP
YY_BREAK
case 13:
YY_RULE_SETUP
#line 231 "toke.l"
#line 230 "toke.l"
{
LEXTRACE("STRBODY ");
if (!append(yytext, yyleng))
@@ -1898,7 +1897,7 @@ YY_RULE_SETUP
case 14:
YY_RULE_SETUP
#line 239 "toke.l"
#line 238 "toke.l"
{
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
@@ -1909,7 +1908,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
#line 247 "toke.l"
#line 246 "toke.l"
{
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
@@ -1920,7 +1919,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
#line 255 "toke.l"
#line 254 "toke.l"
{
BEGIN INITIAL;
yyless(0);
@@ -1929,7 +1928,7 @@ YY_RULE_SETUP
YY_BREAK
case 17:
YY_RULE_SETUP
#line 261 "toke.l"
#line 260 "toke.l"
{
LEXTRACE("ARG ");
if (!fill_args(yytext, yyleng, sawspace))
@@ -1940,7 +1939,7 @@ YY_RULE_SETUP
case 18:
YY_RULE_SETUP
#line 269 "toke.l"
#line 268 "toke.l"
{
char *path;
@@ -1961,7 +1960,7 @@ YY_RULE_SETUP
YY_BREAK
case 19:
YY_RULE_SETUP
#line 287 "toke.l"
#line 286 "toke.l"
{
char *path;
@@ -1985,7 +1984,7 @@ YY_RULE_SETUP
YY_BREAK
case 20:
YY_RULE_SETUP
#line 308 "toke.l"
#line 307 "toke.l"
{
char deftype;
int n;
@@ -2028,7 +2027,7 @@ YY_RULE_SETUP
YY_BREAK
case 21:
YY_RULE_SETUP
#line 348 "toke.l"
#line 347 "toke.l"
{
int n;
@@ -2057,7 +2056,7 @@ YY_RULE_SETUP
YY_BREAK
case 22:
YY_RULE_SETUP
#line 374 "toke.l"
#line 373 "toke.l"
{
/* cmnd does not require passwd for this user */
LEXTRACE("NOPASSWD ");
@@ -2066,7 +2065,7 @@ YY_RULE_SETUP
YY_BREAK
case 23:
YY_RULE_SETUP
#line 380 "toke.l"
#line 379 "toke.l"
{
/* cmnd requires passwd for this user */
LEXTRACE("PASSWD ");
@@ -2075,7 +2074,7 @@ YY_RULE_SETUP
YY_BREAK
case 24:
YY_RULE_SETUP
#line 386 "toke.l"
#line 385 "toke.l"
{
LEXTRACE("NOEXEC ");
LEXRETURN(NOEXEC);
@@ -2083,7 +2082,7 @@ YY_RULE_SETUP
YY_BREAK
case 25:
YY_RULE_SETUP
#line 391 "toke.l"
#line 390 "toke.l"
{
LEXTRACE("EXEC ");
LEXRETURN(EXEC);
@@ -2091,7 +2090,7 @@ YY_RULE_SETUP
YY_BREAK
case 26:
YY_RULE_SETUP
#line 396 "toke.l"
#line 395 "toke.l"
{
LEXTRACE("SETENV ");
LEXRETURN(SETENV);
@@ -2099,7 +2098,7 @@ YY_RULE_SETUP
YY_BREAK
case 27:
YY_RULE_SETUP
#line 401 "toke.l"
#line 400 "toke.l"
{
LEXTRACE("NOSETENV ");
LEXRETURN(NOSETENV);
@@ -2107,7 +2106,7 @@ YY_RULE_SETUP
YY_BREAK
case 28:
YY_RULE_SETUP
#line 406 "toke.l"
#line 405 "toke.l"
{
LEXTRACE("LOG_OUTPUT ");
LEXRETURN(LOG_OUTPUT);
@@ -2115,7 +2114,7 @@ YY_RULE_SETUP
YY_BREAK
case 29:
YY_RULE_SETUP
#line 411 "toke.l"
#line 410 "toke.l"
{
LEXTRACE("NOLOG_OUTPUT ");
LEXRETURN(NOLOG_OUTPUT);
@@ -2123,7 +2122,7 @@ YY_RULE_SETUP
YY_BREAK
case 30:
YY_RULE_SETUP
#line 416 "toke.l"
#line 415 "toke.l"
{
LEXTRACE("LOG_INPUT ");
LEXRETURN(LOG_INPUT);
@@ -2131,7 +2130,7 @@ YY_RULE_SETUP
YY_BREAK
case 31:
YY_RULE_SETUP
#line 421 "toke.l"
#line 420 "toke.l"
{
LEXTRACE("NOLOG_INPUT ");
LEXRETURN(NOLOG_INPUT);
@@ -2139,7 +2138,7 @@ YY_RULE_SETUP
YY_BREAK
case 32:
YY_RULE_SETUP
#line 426 "toke.l"
#line 425 "toke.l"
{
/* empty group or netgroup */
LEXTRACE("ERROR ");
@@ -2148,7 +2147,7 @@ YY_RULE_SETUP
YY_BREAK
case 33:
YY_RULE_SETUP
#line 432 "toke.l"
#line 431 "toke.l"
{
/* netgroup */
if (!fill(yytext, yyleng))
@@ -2159,7 +2158,7 @@ YY_RULE_SETUP
YY_BREAK
case 34:
YY_RULE_SETUP
#line 440 "toke.l"
#line 439 "toke.l"
{
/* group */
if (!fill(yytext, yyleng))
@@ -2170,7 +2169,7 @@ YY_RULE_SETUP
YY_BREAK
case 35:
YY_RULE_SETUP
#line 448 "toke.l"
#line 447 "toke.l"
{
if (!fill(yytext, yyleng))
yyterminate();
@@ -2180,7 +2179,7 @@ YY_RULE_SETUP
YY_BREAK
case 36:
YY_RULE_SETUP
#line 455 "toke.l"
#line 454 "toke.l"
{
if (!fill(yytext, yyleng))
yyterminate();
@@ -2190,7 +2189,7 @@ YY_RULE_SETUP
YY_BREAK
case 37:
YY_RULE_SETUP
#line 462 "toke.l"
#line 461 "toke.l"
{
if (!ipv6_valid(yytext)) {
LEXTRACE("ERROR ");
@@ -2204,7 +2203,7 @@ YY_RULE_SETUP
YY_BREAK
case 38:
YY_RULE_SETUP
#line 473 "toke.l"
#line 472 "toke.l"
{
if (!ipv6_valid(yytext)) {
LEXTRACE("ERROR ");
@@ -2218,7 +2217,7 @@ YY_RULE_SETUP
YY_BREAK
case 39:
YY_RULE_SETUP
#line 484 "toke.l"
#line 483 "toke.l"
{
LEXTRACE("ALL ");
LEXRETURN(ALL);
@@ -2227,7 +2226,7 @@ YY_RULE_SETUP
YY_BREAK
case 40:
YY_RULE_SETUP
#line 490 "toke.l"
#line 489 "toke.l"
{
#ifdef HAVE_SELINUX
LEXTRACE("ROLE ");
@@ -2239,7 +2238,7 @@ YY_RULE_SETUP
YY_BREAK
case 41:
YY_RULE_SETUP
#line 499 "toke.l"
#line 498 "toke.l"
{
#ifdef HAVE_SELINUX
LEXTRACE("TYPE ");
@@ -2251,7 +2250,7 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
#line 507 "toke.l"
#line 506 "toke.l"
{
#ifdef HAVE_PRIV_SET
LEXTRACE("PRIVS ");
@@ -2263,7 +2262,7 @@ YY_RULE_SETUP
YY_BREAK
case 43:
YY_RULE_SETUP
#line 516 "toke.l"
#line 515 "toke.l"
{
#ifdef HAVE_PRIV_SET
LEXTRACE("LIMITPRIVS ");
@@ -2275,7 +2274,7 @@ YY_RULE_SETUP
YY_BREAK
case 44:
YY_RULE_SETUP
#line 525 "toke.l"
#line 524 "toke.l"
{
got_alias:
if (!fill(yytext, yyleng))
@@ -2286,7 +2285,7 @@ YY_RULE_SETUP
YY_BREAK
case 45:
YY_RULE_SETUP
#line 533 "toke.l"
#line 532 "toke.l"
{
/* no command args allowed for Defaults!/path */
if (!fill_cmnd(yytext, yyleng))
@@ -2297,7 +2296,7 @@ YY_RULE_SETUP
YY_BREAK
case 46:
YY_RULE_SETUP
#line 541 "toke.l"
#line 540 "toke.l"
{
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
@@ -2307,7 +2306,7 @@ YY_RULE_SETUP
YY_BREAK
case 47:
YY_RULE_SETUP
#line 548 "toke.l"
#line 547 "toke.l"
{
/* directories can't have args... */
if (yytext[yyleng - 1] == '/') {
@@ -2325,7 +2324,7 @@ YY_RULE_SETUP
YY_BREAK
case 48:
YY_RULE_SETUP
#line 563 "toke.l"
#line 562 "toke.l"
{
LEXTRACE("BEGINSTR ");
yylval.string = NULL;
@@ -2335,7 +2334,7 @@ YY_RULE_SETUP
YY_BREAK
case 49:
YY_RULE_SETUP
#line 570 "toke.l"
#line 569 "toke.l"
{
/* a word */
if (!fill(yytext, yyleng))
@@ -2346,7 +2345,7 @@ YY_RULE_SETUP
YY_BREAK
case 50:
YY_RULE_SETUP
#line 578 "toke.l"
#line 577 "toke.l"
{
LEXTRACE("( ");
LEXRETURN('(');
@@ -2354,7 +2353,7 @@ YY_RULE_SETUP
YY_BREAK
case 51:
YY_RULE_SETUP
#line 583 "toke.l"
#line 582 "toke.l"
{
LEXTRACE(") ");
LEXRETURN(')');
@@ -2362,7 +2361,7 @@ YY_RULE_SETUP
YY_BREAK
case 52:
YY_RULE_SETUP
#line 588 "toke.l"
#line 587 "toke.l"
{
LEXTRACE(", ");
LEXRETURN(',');
@@ -2370,7 +2369,7 @@ YY_RULE_SETUP
YY_BREAK
case 53:
YY_RULE_SETUP
#line 593 "toke.l"
#line 592 "toke.l"
{
LEXTRACE("= ");
LEXRETURN('=');
@@ -2378,7 +2377,7 @@ YY_RULE_SETUP
YY_BREAK
case 54:
YY_RULE_SETUP
#line 598 "toke.l"
#line 597 "toke.l"
{
LEXTRACE(": ");
LEXRETURN(':');
@@ -2386,7 +2385,7 @@ YY_RULE_SETUP
YY_BREAK
case 55:
YY_RULE_SETUP
#line 603 "toke.l"
#line 602 "toke.l"
{
if (yyleng & 1) {
LEXTRACE("!");
@@ -2396,7 +2395,7 @@ YY_RULE_SETUP
YY_BREAK
case 56:
YY_RULE_SETUP
#line 610 "toke.l"
#line 609 "toke.l"
{
if (YY_START == INSTR) {
LEXTRACE("ERROR ");
@@ -2411,14 +2410,14 @@ YY_RULE_SETUP
YY_BREAK
case 57:
YY_RULE_SETUP
#line 622 "toke.l"
#line 621 "toke.l"
{ /* throw away space/tabs */
sawspace = true; /* but remember for fill_args */
}
YY_BREAK
case 58:
YY_RULE_SETUP
#line 626 "toke.l"
#line 625 "toke.l"
{
sawspace = true; /* remember for fill_args */
sudolineno++;
@@ -2427,7 +2426,7 @@ YY_RULE_SETUP
YY_BREAK
case 59:
YY_RULE_SETUP
#line 632 "toke.l"
#line 631 "toke.l"
{
BEGIN INITIAL;
sudolineno++;
@@ -2438,7 +2437,7 @@ YY_RULE_SETUP
YY_BREAK
case 60:
YY_RULE_SETUP
#line 640 "toke.l"
#line 639 "toke.l"
{
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
@@ -2450,7 +2449,7 @@ case YY_STATE_EOF(GOTCMND):
case YY_STATE_EOF(STARTDEFS):
case YY_STATE_EOF(INDEFS):
case YY_STATE_EOF(INSTR):
#line 645 "toke.l"
#line 644 "toke.l"
{
if (YY_START != INITIAL) {
BEGIN INITIAL;
@@ -2463,10 +2462,10 @@ case YY_STATE_EOF(INSTR):
YY_BREAK
case 61:
YY_RULE_SETUP
#line 655 "toke.l"
#line 654 "toke.l"
ECHO;
YY_BREAK
#line 2469 "lex.yy.c"
#line 2468 "lex.yy.c"
case YY_END_OF_BUFFER:
{
@@ -3357,7 +3356,7 @@ int main()
return 0;
}
#endif
#line 655 "toke.l"
#line 654 "toke.l"
struct path_list {
char *path;
@@ -3718,13 +3717,13 @@ parse_include(char *base)
}
#ifdef TRACELEXER
static int
int
sudoers_trace_print(const char *msg)
{
return fputs(msg, stderr);
}
#else
static int
int
sudoers_trace_print(const char *msg)
{
static bool initialized;