From: Todd C. Miller Date: Thu, 23 Aug 2012 15:28:44 +0000 (-0400) Subject: Avoid printing the >>> parse error <<< message for testsudoers X-Git-Tag: SUDO_1_8_6^2~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c8c3c0cd824a4af25cb7fcdc03dc061b875ad9e;p=sudo Avoid printing the >>> parse error <<< message for testsudoers when the -t flag is specified. --- diff --git a/plugins/sudoers/gram.c b/plugins/sudoers/gram.c index 80326ae10..b309b5210 100644 --- a/plugins/sudoers/gram.c +++ b/plugins/sudoers/gram.c @@ -121,12 +121,13 @@ yyerror(const char *s) } LEXTRACE("<*> "); #ifndef TRACELEXER - warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno); + if (trace_print == NULL || trace_print == sudoers_trace_print) + warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno); #endif parse_error = true; debug_return; } -#line 119 "gram.y" +#line 120 "gram.y" #ifndef YYSTYPE_DEFINED #define YYSTYPE_DEFINED typedef union { @@ -143,7 +144,7 @@ typedef union { int tok; } YYSTYPE; #endif /* YYSTYPE_DEFINED */ -#line 146 "gram.c" +#line 147 "gram.c" #define COMMAND 257 #define ALIAS 258 #define DEFVAR 259 @@ -670,7 +671,7 @@ short *yyss; short *yysslim; YYSTYPE *yyvs; int yystacksize; -#line 671 "gram.y" +#line 672 "gram.y" static struct defaults * new_default(char *var, char *val, int op) { @@ -873,7 +874,7 @@ init_parser(const char *path, bool quiet) debug_return; } -#line 824 "gram.c" +#line 825 "gram.c" /* allocate initial stack or double stack size, up to YYMAXDEPTH */ #if defined(__cplusplus) || defined(__STDC__) static int yygrowstack(void) @@ -885,9 +886,8 @@ static int yygrowstack() short *newss; YYSTYPE *newvs; - if ((newsize = yystacksize) == 0) - newsize = YYINITSTACKSIZE; - else if (newsize >= YYMAXDEPTH) + newsize = yystacksize ? yystacksize : YYINITSTACKSIZE; + if (newsize >= YYMAXDEPTH) return -1; else if ((newsize *= 2) > YYMAXDEPTH) newsize = YYMAXDEPTH; @@ -1077,127 +1077,127 @@ yyreduce: switch (yyn) { case 1: -#line 201 "gram.y" +#line 202 "gram.y" { ; } break; case 5: -#line 209 "gram.y" +#line 210 "gram.y" { ; } break; case 6: -#line 212 "gram.y" +#line 213 "gram.y" { yyerrok; } break; case 7: -#line 215 "gram.y" +#line 216 "gram.y" { add_userspec(yyvsp[-1].member, yyvsp[0].privilege); } break; case 8: -#line 218 "gram.y" +#line 219 "gram.y" { ; } break; case 9: -#line 221 "gram.y" +#line 222 "gram.y" { ; } break; case 10: -#line 224 "gram.y" +#line 225 "gram.y" { ; } break; case 11: -#line 227 "gram.y" +#line 228 "gram.y" { ; } break; case 12: -#line 230 "gram.y" +#line 231 "gram.y" { add_defaults(DEFAULTS, NULL, yyvsp[0].defaults); } break; case 13: -#line 233 "gram.y" +#line 234 "gram.y" { add_defaults(DEFAULTS_USER, yyvsp[-1].member, yyvsp[0].defaults); } break; case 14: -#line 236 "gram.y" +#line 237 "gram.y" { add_defaults(DEFAULTS_RUNAS, yyvsp[-1].member, yyvsp[0].defaults); } break; case 15: -#line 239 "gram.y" +#line 240 "gram.y" { add_defaults(DEFAULTS_HOST, yyvsp[-1].member, yyvsp[0].defaults); } break; case 16: -#line 242 "gram.y" +#line 243 "gram.y" { add_defaults(DEFAULTS_CMND, yyvsp[-1].member, yyvsp[0].defaults); } break; case 18: -#line 248 "gram.y" +#line 249 "gram.y" { list_append(yyvsp[-2].defaults, yyvsp[0].defaults); yyval.defaults = yyvsp[-2].defaults; } break; case 19: -#line 254 "gram.y" +#line 255 "gram.y" { yyval.defaults = new_default(yyvsp[0].string, NULL, true); } break; case 20: -#line 257 "gram.y" +#line 258 "gram.y" { yyval.defaults = new_default(yyvsp[0].string, NULL, false); } break; case 21: -#line 260 "gram.y" +#line 261 "gram.y" { yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, true); } break; case 22: -#line 263 "gram.y" +#line 264 "gram.y" { yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '+'); } break; case 23: -#line 266 "gram.y" +#line 267 "gram.y" { yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '-'); } break; case 25: -#line 272 "gram.y" +#line 273 "gram.y" { list_append(yyvsp[-2].privilege, yyvsp[0].privilege); yyval.privilege = yyvsp[-2].privilege; } break; case 26: -#line 278 "gram.y" +#line 279 "gram.y" { struct privilege *p = ecalloc(1, sizeof(*p)); list2tq(&p->hostlist, yyvsp[-2].member); @@ -1208,51 +1208,51 @@ case 26: } break; case 27: -#line 288 "gram.y" +#line 289 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = false; } break; case 28: -#line 292 "gram.y" +#line 293 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = true; } break; case 29: -#line 298 "gram.y" +#line 299 "gram.y" { yyval.member = new_member(yyvsp[0].string, ALIAS); } break; case 30: -#line 301 "gram.y" +#line 302 "gram.y" { yyval.member = new_member(NULL, ALL); } break; case 31: -#line 304 "gram.y" +#line 305 "gram.y" { yyval.member = new_member(yyvsp[0].string, NETGROUP); } break; case 32: -#line 307 "gram.y" +#line 308 "gram.y" { yyval.member = new_member(yyvsp[0].string, NTWKADDR); } break; case 33: -#line 310 "gram.y" +#line 311 "gram.y" { yyval.member = new_member(yyvsp[0].string, WORD); } break; case 35: -#line 316 "gram.y" +#line 317 "gram.y" { list_append(yyvsp[-2].cmndspec, yyvsp[0].cmndspec); #ifdef HAVE_SELINUX @@ -1292,7 +1292,7 @@ case 35: } break; case 36: -#line 355 "gram.y" +#line 356 "gram.y" { struct cmndspec *cs = ecalloc(1, sizeof(*cs)); if (yyvsp[-4].runas != NULL) { @@ -1323,127 +1323,127 @@ case 36: } break; case 37: -#line 385 "gram.y" +#line 386 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = false; } break; case 38: -#line 389 "gram.y" +#line 390 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = true; } break; case 39: -#line 395 "gram.y" +#line 396 "gram.y" { yyval.string = yyvsp[0].string; } break; case 40: -#line 400 "gram.y" +#line 401 "gram.y" { yyval.string = yyvsp[0].string; } break; case 41: -#line 405 "gram.y" +#line 406 "gram.y" { yyval.seinfo.role = NULL; yyval.seinfo.type = NULL; } break; case 42: -#line 409 "gram.y" +#line 410 "gram.y" { yyval.seinfo.role = yyvsp[0].string; yyval.seinfo.type = NULL; } break; case 43: -#line 413 "gram.y" +#line 414 "gram.y" { yyval.seinfo.type = yyvsp[0].string; yyval.seinfo.role = NULL; } break; case 44: -#line 417 "gram.y" +#line 418 "gram.y" { yyval.seinfo.role = yyvsp[-1].string; yyval.seinfo.type = yyvsp[0].string; } break; case 45: -#line 421 "gram.y" +#line 422 "gram.y" { yyval.seinfo.type = yyvsp[-1].string; yyval.seinfo.role = yyvsp[0].string; } break; case 46: -#line 427 "gram.y" +#line 428 "gram.y" { yyval.string = yyvsp[0].string; } break; case 47: -#line 431 "gram.y" +#line 432 "gram.y" { yyval.string = yyvsp[0].string; } break; case 48: -#line 436 "gram.y" +#line 437 "gram.y" { yyval.privinfo.privs = NULL; yyval.privinfo.limitprivs = NULL; } break; case 49: -#line 440 "gram.y" +#line 441 "gram.y" { yyval.privinfo.privs = yyvsp[0].string; yyval.privinfo.limitprivs = NULL; } break; case 50: -#line 444 "gram.y" +#line 445 "gram.y" { yyval.privinfo.privs = NULL; yyval.privinfo.limitprivs = yyvsp[0].string; } break; case 51: -#line 448 "gram.y" +#line 449 "gram.y" { yyval.privinfo.privs = yyvsp[-1].string; yyval.privinfo.limitprivs = yyvsp[0].string; } break; case 52: -#line 452 "gram.y" +#line 453 "gram.y" { yyval.privinfo.limitprivs = yyvsp[-1].string; yyval.privinfo.privs = yyvsp[0].string; } break; case 53: -#line 457 "gram.y" +#line 458 "gram.y" { yyval.runas = NULL; } break; case 54: -#line 460 "gram.y" +#line 461 "gram.y" { yyval.runas = yyvsp[-1].runas; } break; case 55: -#line 465 "gram.y" +#line 466 "gram.y" { yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = new_member(NULL, MYSELF); @@ -1451,7 +1451,7 @@ case 55: } break; case 56: -#line 470 "gram.y" +#line 471 "gram.y" { yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = yyvsp[0].member; @@ -1459,7 +1459,7 @@ case 56: } break; case 57: -#line 475 "gram.y" +#line 476 "gram.y" { yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = yyvsp[-2].member; @@ -1467,7 +1467,7 @@ case 57: } break; case 58: -#line 480 "gram.y" +#line 481 "gram.y" { yyval.runas = ecalloc(1, sizeof(struct runascontainer)); /* $$->runasusers = NULL; */ @@ -1475,7 +1475,7 @@ case 58: } break; case 59: -#line 485 "gram.y" +#line 486 "gram.y" { yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas->runasusers = new_member(NULL, MYSELF); @@ -1483,86 +1483,86 @@ case 59: } break; case 60: -#line 492 "gram.y" +#line 493 "gram.y" { yyval.tag.nopasswd = yyval.tag.noexec = yyval.tag.setenv = yyval.tag.log_input = yyval.tag.log_output = UNSPEC; } break; case 61: -#line 496 "gram.y" +#line 497 "gram.y" { yyval.tag.nopasswd = true; } break; case 62: -#line 499 "gram.y" +#line 500 "gram.y" { yyval.tag.nopasswd = false; } break; case 63: -#line 502 "gram.y" +#line 503 "gram.y" { yyval.tag.noexec = true; } break; case 64: -#line 505 "gram.y" +#line 506 "gram.y" { yyval.tag.noexec = false; } break; case 65: -#line 508 "gram.y" +#line 509 "gram.y" { yyval.tag.setenv = true; } break; case 66: -#line 511 "gram.y" +#line 512 "gram.y" { yyval.tag.setenv = false; } break; case 67: -#line 514 "gram.y" +#line 515 "gram.y" { yyval.tag.log_input = true; } break; case 68: -#line 517 "gram.y" +#line 518 "gram.y" { yyval.tag.log_input = false; } break; case 69: -#line 520 "gram.y" +#line 521 "gram.y" { yyval.tag.log_output = true; } break; case 70: -#line 523 "gram.y" +#line 524 "gram.y" { yyval.tag.log_output = false; } break; case 71: -#line 528 "gram.y" +#line 529 "gram.y" { yyval.member = new_member(NULL, ALL); } break; case 72: -#line 531 "gram.y" +#line 532 "gram.y" { yyval.member = new_member(yyvsp[0].string, ALIAS); } break; case 73: -#line 534 "gram.y" +#line 535 "gram.y" { struct sudo_command *c = ecalloc(1, sizeof(*c)); c->cmnd = yyvsp[0].command.cmnd; @@ -1571,7 +1571,7 @@ case 73: } break; case 76: -#line 546 "gram.y" +#line 547 "gram.y" { char *s; if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) { @@ -1581,14 +1581,14 @@ case 76: } break; case 78: -#line 556 "gram.y" +#line 557 "gram.y" { list_append(yyvsp[-2].member, yyvsp[0].member); yyval.member = yyvsp[-2].member; } break; case 81: -#line 566 "gram.y" +#line 567 "gram.y" { char *s; if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) { @@ -1598,14 +1598,14 @@ case 81: } break; case 83: -#line 576 "gram.y" +#line 577 "gram.y" { list_append(yyvsp[-2].member, yyvsp[0].member); yyval.member = yyvsp[-2].member; } break; case 86: -#line 586 "gram.y" +#line 587 "gram.y" { char *s; if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) { @@ -1615,7 +1615,7 @@ case 86: } break; case 89: -#line 599 "gram.y" +#line 600 "gram.y" { char *s; if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) { @@ -1625,91 +1625,91 @@ case 89: } break; case 91: -#line 609 "gram.y" +#line 610 "gram.y" { list_append(yyvsp[-2].member, yyvsp[0].member); yyval.member = yyvsp[-2].member; } break; case 92: -#line 615 "gram.y" +#line 616 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = false; } break; case 93: -#line 619 "gram.y" +#line 620 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = true; } break; case 94: -#line 625 "gram.y" +#line 626 "gram.y" { yyval.member = new_member(yyvsp[0].string, ALIAS); } break; case 95: -#line 628 "gram.y" +#line 629 "gram.y" { yyval.member = new_member(NULL, ALL); } break; case 96: -#line 631 "gram.y" +#line 632 "gram.y" { yyval.member = new_member(yyvsp[0].string, NETGROUP); } break; case 97: -#line 634 "gram.y" +#line 635 "gram.y" { yyval.member = new_member(yyvsp[0].string, USERGROUP); } break; case 98: -#line 637 "gram.y" +#line 638 "gram.y" { yyval.member = new_member(yyvsp[0].string, WORD); } break; case 100: -#line 643 "gram.y" +#line 644 "gram.y" { list_append(yyvsp[-2].member, yyvsp[0].member); yyval.member = yyvsp[-2].member; } break; case 101: -#line 649 "gram.y" +#line 650 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = false; } break; case 102: -#line 653 "gram.y" +#line 654 "gram.y" { yyval.member = yyvsp[0].member; yyval.member->negated = true; } break; case 103: -#line 659 "gram.y" +#line 660 "gram.y" { yyval.member = new_member(yyvsp[0].string, ALIAS); } break; case 104: -#line 662 "gram.y" +#line 663 "gram.y" { yyval.member = new_member(NULL, ALL); } break; case 105: -#line 665 "gram.y" +#line 666 "gram.y" { yyval.member = new_member(yyvsp[0].string, WORD); } diff --git a/plugins/sudoers/gram.y b/plugins/sudoers/gram.y index 37380f583..e9932c5f3 100644 --- a/plugins/sudoers/gram.y +++ b/plugins/sudoers/gram.y @@ -109,7 +109,8 @@ yyerror(const char *s) } LEXTRACE("<*> "); #ifndef TRACELEXER - warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno); + if (trace_print == NULL || trace_print == sudoers_trace_print) + warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno); #endif parse_error = true; debug_return; diff --git a/plugins/sudoers/toke.c b/plugins/sudoers/toke.c index 946bb6d42..41a97474e 100644 --- a/plugins/sudoers/toke.c +++ b/plugins/sudoers/toke.c @@ -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; diff --git a/plugins/sudoers/toke.h b/plugins/sudoers/toke.h index efcb4f4f2..c0ab53fe1 100644 --- a/plugins/sudoers/toke.h +++ b/plugins/sudoers/toke.h @@ -22,6 +22,7 @@ bool fill_args(const char *, int, int); bool fill_cmnd(const char *, int); bool fill_txt(const char *, int, int); bool ipv6_valid(const char *s); +int sudoers_trace_print(const char *msg); void yyerror(const char *); #ifndef FLEX_SCANNER diff --git a/plugins/sudoers/toke.l b/plugins/sudoers/toke.l index a27646482..a8169fd06 100644 --- a/plugins/sudoers/toke.l +++ b/plugins/sudoers/toke.l @@ -94,7 +94,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 { \ @@ -1012,13 +1011,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;