else \
gram_y="$(srcdir)/gram.y"; \
fi; \
- cmd='$(YACC) -d '"$$gram_y"'; echo "#include <config.h>" > $(devdir)/gram.c; sed "s/^\\(#line .*\\) \"y\\.tab\\.c\"/\1 \"gram.c\"/" y.tab.c >> $(devdir)/gram.c; rm -f y.tab.c; mv -f y.tab.h $(devdir)/gram.h'; \
+ cmd='$(YACC) -d -p sudoers '"$$gram_y"'; echo "#include <config.h>" > $(devdir)/gram.c; sed "s/^\\(#line .*\\) \"y\\.tab\\.c\"/\1 \"gram.c\"/" y.tab.c >> $(devdir)/gram.c; rm -f y.tab.c; mv -f y.tab.h $(devdir)/gram.h'; \
echo "$$cmd"; eval $$cmd; \
fi
else \
toke_l="$(srcdir)/toke.l"; \
fi; \
- cmd='$(FLEX) '"$$toke_l"'; echo "#include <config.h>" > $(devdir)/toke.c; cat lex.yy.c >> $(devdir)/toke.c; rm -f lex.yy.c'; \
+ cmd='$(FLEX) '"$$toke_l"'; echo "#include <config.h>" > $(devdir)/toke.c; cat lex.sudoers.c >> $(devdir)/toke.c; rm -f lex.sudoers.c'; \
echo "$$cmd"; eval $$cmd; \
fi
#define yyclearin (yychar=(YYEMPTY))
#define yyerrok (yyerrflag=0)
#define YYRECOVERING() (yyerrflag!=0)
-#define YYPREFIX "yy"
+#define yyparse sudoersparse
+#define yylex sudoerslex
+#define yyerror sudoerserror
+#define yychar sudoerschar
+#define yyval sudoersval
+#define yylval sudoerslval
+#define yydebug sudoersdebug
+#define yynerrs sudoersnerrs
+#define yyerrflag sudoerserrflag
+#define yyss sudoersss
+#define yysslim sudoerssslim
+#define yyssp sudoersssp
+#define yyvs sudoersvs
+#define yyvsp sudoersvsp
+#define yystacksize sudoersstacksize
+#define yylhs sudoerslhs
+#define yylen sudoerslen
+#define yydefred sudoersdefred
+#define yydgoto sudoersdgoto
+#define yysindex sudoerssindex
+#define yyrindex sudoersrindex
+#define yygindex sudoersgindex
+#define yytable sudoerstable
+#define yycheck sudoerscheck
+#define yyname sudoersname
+#define yyrule sudoersrule
+#define YYPREFIX "sudoers"
#line 2 "gram.y"
/*
* Copyright (c) 1996, 1998-2005, 2007-2012
int tok;
} YYSTYPE;
#endif /* YYSTYPE_DEFINED */
-#line 149 "gram.c"
+#line 175 "gram.c"
#define COMMAND 257
#define ALIAS 258
#define DEFVAR 259
#define MYSELF 290
#define YYERRCODE 256
#if defined(__cplusplus) || defined(__STDC__)
-const short yylhs[] =
+const short sudoerslhs[] =
#else
-short yylhs[] =
+short sudoerslhs[] =
#endif
{ -1,
0, 0, 28, 28, 29, 29, 29, 29, 29, 29,
14, 14, 15, 15, 15,
};
#if defined(__cplusplus) || defined(__STDC__)
-const short yylen[] =
+const short sudoerslen[] =
#else
-short yylen[] =
+short sudoerslen[] =
#endif
{ 2,
0, 1, 1, 2, 1, 2, 2, 2, 2, 2,
1, 2, 1, 1, 1,
};
#if defined(__cplusplus) || defined(__STDC__)
-const short yydefred[] =
+const short sudoersdefred[] =
#else
-short yydefred[] =
+short sudoersdefred[] =
#endif
{ 0,
0, 94, 96, 97, 98, 0, 0, 0, 0, 0,
63, 64, 65, 66, 67, 68, 69, 70, 36,
};
#if defined(__cplusplus) || defined(__STDC__)
-const short yydgoto[] =
+const short sudoersdgoto[] =
#else
-short yydgoto[] =
+short sudoersdgoto[] =
#endif
{ 18,
104, 105, 27, 28, 44, 45, 46, 35, 61, 37,
48, 51, 57, 49, 52, 58, 55,
};
#if defined(__cplusplus) || defined(__STDC__)
-const short yysindex[] =
+const short sudoerssindex[] =
#else
-short yysindex[] =
+short sudoerssindex[] =
#endif
{ 541,
-270, 0, 0, 0, 0, -21, -5, 553, 553, 20,
-169, -168, 569, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,};
#if defined(__cplusplus) || defined(__STDC__)
-const short yyrindex[] =
+const short sudoersrindex[] =
#else
-short yyrindex[] =
+short sudoersrindex[] =
#endif
{ 96,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,};
#if defined(__cplusplus) || defined(__STDC__)
-const short yygindex[] =
+const short sudoersgindex[] =
#else
-short yygindex[] =
+short sudoersgindex[] =
#endif
{ 0,
-11, 0, 39, 12, 66, -72, 27, 76, -4, 40,
};
#define YYTABLESIZE 932
#if defined(__cplusplus) || defined(__STDC__)
-const short yytable[] =
+const short sudoerstable[] =
#else
-short yytable[] =
+short sudoerstable[] =
#endif
{ 26,
19, 26, 36, 94, 41, 34, 38, 39, 26, 24,
50, 50,
};
#if defined(__cplusplus) || defined(__STDC__)
-const short yycheck[] =
+const short sudoerscheck[] =
#else
-short yycheck[] =
+short sudoerscheck[] =
#endif
{ 33,
0, 33, 7, 76, 33, 33, 8, 9, 33, 280,
#define YYMAXTOKEN 290
#if YYDEBUG
#if defined(__cplusplus) || defined(__STDC__)
-const char * const yyname[] =
+const char * const sudoersname[] =
#else
-char *yyname[] =
+char *sudoersname[] =
#endif
{
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
"RUNASALIAS","ERROR","TYPE","ROLE","PRIVS","LIMITPRIVS","MYSELF",
};
#if defined(__cplusplus) || defined(__STDC__)
-const char * const yyrule[] =
+const char * const sudoersrule[] =
#else
-char *yyrule[] =
+char *sudoersrule[] =
#endif
{"$accept : file",
"file :",
debug_return;
}
-#line 827 "gram.c"
+#line 853 "gram.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
#if defined(__cplusplus) || defined(__STDC__)
static int yygrowstack(void)
yyval.member = new_member(yyvsp[0].string, WORD);
}
break;
-#line 1667 "gram.c"
+#line 1693 "gram.c"
}
yyssp -= yym;
yystate = *yyssp;
int tok;
} YYSTYPE;
#endif /* YYSTYPE_DEFINED */
-extern YYSTYPE yylval;
+extern YYSTYPE sudoerslval;
/*
* Parser externs.
*/
-extern FILE *yyin;
+extern FILE *sudoersin;
extern char *errorfile;
extern int errorlineno;
extern bool parse_error;
if (nss->handle != NULL) {
fclose(nss->handle);
nss->handle = NULL;
- yyin = NULL;
+ sudoersin = NULL;
}
debug_return_int(0);
}
debug_return_int(-1);
init_parser(sudoers_file, false);
- yyin = nss->handle;
- if (yyparse() != 0 || parse_error) {
+ sudoersin = nss->handle;
+ if (sudoersparse() != 0 || parse_error) {
if (errorlineno != -1) {
log_error(0, _("parse error in %s near line %d"),
errorfile, errorlineno);
sudo_conv_t sudo_conv; /* NULL in non-plugin */
-YYSTYPE yylval;
+YYSTYPE sudoerslval;
struct fill_test {
const char *input;
{
if (!fill(input, len))
return -1;
- *resultp = yylval.string;
- return !strcmp(yylval.string, expect);
+ *resultp = sudoerslval.string;
+ return !strcmp(sudoerslval.string, expect);
}
static int
{
if (!fill_cmnd(input, len))
return -1;
- *resultp = yylval.command.cmnd;
- return !strcmp(yylval.command.cmnd, expect);
+ *resultp = sudoerslval.command.cmnd;
+ return !strcmp(sudoerslval.command.cmnd, expect);
}
static int
{
if (!fill_args(input, len, addspace))
return -1;
- *resultp = yylval.command.args;
- return !strcmp(yylval.command.args, expect);
+ *resultp = sudoerslval.command.args;
+ return !strcmp(sudoerslval.command.args, expect);
}
static int
/* STUB */
void
-yyerror(const char *s)
+sudoerserror(const char *s)
{
return;
}
/*
* Function prototypes
*/
-#define YY_DECL int yylex(void)
+#define YY_DECL int sudoerslex(void)
/* goodpath.c */
bool sudo_goodpath(const char *, struct stat *);
int pam_prep_user(struct passwd *);
/* gram.y */
-int yyparse(void);
+int sudoersparse(void);
/* toke.l */
YY_DECL;
extern char *malloc_options;
#endif
#ifdef YYDEBUG
-extern int yydebug;
+extern int sudoersdebug;
#endif
int
malloc_options = "AFGJPR";
#endif
#ifdef YYDEBUG
- yydebug = 1;
+ sudoersdebug = 1;
#endif
#if !defined(HAVE_GETPROGNAME) && !defined(HAVE___PROGNAME)
/* Allocate space for data structures in the parser. */
init_parser("sudoers", false);
- if (yyparse() != 0 || parse_error) {
+ if (sudoersparse() != 0 || parse_error) {
parse_error = true;
if (errorlineno != -1)
(void) printf("Parse error in %s near line %d",
#include <config.h>
+#define yy_create_buffer sudoers_create_buffer
+#define yy_delete_buffer sudoers_delete_buffer
+#define yy_scan_buffer sudoers_scan_buffer
+#define yy_scan_string sudoers_scan_string
+#define yy_scan_bytes sudoers_scan_bytes
+#define yy_flex_debug sudoers_flex_debug
+#define yy_init_buffer sudoers_init_buffer
+#define yy_flush_buffer sudoers_flush_buffer
+#define yy_load_buffer_state sudoers_load_buffer_state
+#define yy_switch_to_buffer sudoers_switch_to_buffer
+#define yyin sudoersin
+#define yyleng sudoersleng
+#define yylex sudoerslex
+#define yyout sudoersout
+#define yyrestart sudoersrestart
+#define yytext sudoerstext
+
/* $OpenBSD: flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $ */
/* A lexical scanner generated by flex */
#include "lbuf.h"
#include "secure_path.h"
-extern YYSTYPE yylval;
+extern YYSTYPE sudoerslval;
extern bool parse_error;
extern bool sudoers_warnings;
int sudolineno;
return (n); \
} while (0)
-#define ECHO ignore_result(fwrite(yytext, yyleng, 1, yyout))
+#define ECHO ignore_result(fwrite(sudoerstext, sudoersleng, 1, sudoersout))
#define push_include(_p) (_push_include((_p), false))
#define push_includedir(_p) (_push_include((_p), true))
#define INSTR 5
-#line 1514 "lex.yy.c"
+#line 1531 "lex.sudoers.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
register char *yy_cp, *yy_bp;
register int yy_act;
-#line 132 "toke.l"
+#line 133 "toke.l"
-#line 1670 "lex.yy.c"
+#line 1687 "lex.sudoers.c"
if ( yy_init )
{
case 1:
YY_RULE_SETUP
-#line 133 "toke.l"
+#line 134 "toke.l"
{
LEXTRACE(", ");
LEXRETURN(',');
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 138 "toke.l"
+#line 139 "toke.l"
BEGIN STARTDEFS;
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 140 "toke.l"
+#line 141 "toke.l"
{
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(DEFVAR);
}
case 4:
YY_RULE_SETUP
-#line 149 "toke.l"
+#line 150 "toke.l"
{
BEGIN STARTDEFS;
LEXTRACE(", ");
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 155 "toke.l"
+#line 156 "toke.l"
{
LEXTRACE("= ");
LEXRETURN('=');
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 160 "toke.l"
+#line 161 "toke.l"
{
LEXTRACE("+= ");
LEXRETURN('+');
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 165 "toke.l"
+#line 166 "toke.l"
{
LEXTRACE("-= ");
LEXRETURN('-');
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 170 "toke.l"
+#line 171 "toke.l"
{
LEXTRACE("BEGINSTR ");
- yylval.string = NULL;
+ sudoerslval.string = NULL;
prev_state = YY_START;
BEGIN INSTR;
}
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 177 "toke.l"
+#line 178 "toke.l"
{
LEXTRACE("WORD(2) ");
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(WORD);
}
case 10:
YY_RULE_SETUP
-#line 186 "toke.l"
+#line 187 "toke.l"
{
/* Line continuation char followed by newline. */
sudolineno++;
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 192 "toke.l"
+#line 193 "toke.l"
{
LEXTRACE("ENDSTR ");
BEGIN prev_state;
- if (yylval.string == NULL) {
+ if (sudoerslval.string == NULL) {
LEXTRACE("ERROR "); /* empty string */
LEXRETURN(ERROR);
}
if (prev_state == INITIAL) {
- switch (yylval.string[0]) {
+ switch (sudoerslval.string[0]) {
case '%':
- if (yylval.string[1] == '\0' ||
- (yylval.string[1] == ':' &&
- yylval.string[2] == '\0')) {
+ if (sudoerslval.string[1] == '\0' ||
+ (sudoerslval.string[1] == ':' &&
+ sudoerslval.string[2] == '\0')) {
LEXTRACE("ERROR "); /* empty group */
LEXRETURN(ERROR);
}
LEXTRACE("USERGROUP ");
LEXRETURN(USERGROUP);
case '+':
- if (yylval.string[1] == '\0') {
+ if (sudoerslval.string[1] == '\0') {
LEXTRACE("ERROR "); /* empty netgroup */
LEXRETURN(ERROR);
}
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 224 "toke.l"
+#line 225 "toke.l"
{
LEXTRACE("BACKSLASH ");
- if (!append(yytext, yyleng))
+ if (!append(sudoerstext, sudoersleng))
yyterminate();
}
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 230 "toke.l"
+#line 231 "toke.l"
{
LEXTRACE("STRBODY ");
- if (!append(yytext, yyleng))
+ if (!append(sudoerstext, sudoersleng))
yyterminate();
}
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 238 "toke.l"
+#line 239 "toke.l"
{
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
- if (!fill_args(yytext, 2, sawspace))
+ if (!fill_args(sudoerstext, 2, sawspace))
yyterminate();
sawspace = false;
}
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 246 "toke.l"
+#line 247 "toke.l"
{
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
- if (!fill_args(yytext + 1, 1, sawspace))
+ if (!fill_args(sudoerstext + 1, 1, sawspace))
yyterminate();
sawspace = false;
}
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 254 "toke.l"
+#line 255 "toke.l"
{
BEGIN INITIAL;
yyless(0);
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 260 "toke.l"
+#line 261 "toke.l"
{
LEXTRACE("ARG ");
- if (!fill_args(yytext, yyleng, sawspace))
+ if (!fill_args(sudoerstext, sudoersleng, sawspace))
yyterminate();
sawspace = false;
} /* a command line arg */
case 18:
YY_RULE_SETUP
-#line 268 "toke.l"
+#line 269 "toke.l"
{
char *path;
LEXRETURN(ERROR);
}
- if ((path = parse_include(yytext)) == NULL)
+ if ((path = parse_include(sudoerstext)) == NULL)
yyterminate();
LEXTRACE("INCLUDE\n");
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 286 "toke.l"
+#line 287 "toke.l"
{
char *path;
LEXRETURN(ERROR);
}
- if ((path = parse_include(yytext)) == NULL)
+ if ((path = parse_include(sudoerstext)) == NULL)
yyterminate();
LEXTRACE("INCLUDEDIR\n");
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 307 "toke.l"
+#line 308 "toke.l"
{
char deftype;
int n;
LEXRETURN(ERROR);
}
- for (n = 0; isblank((unsigned char)yytext[n]); n++)
+ for (n = 0; isblank((unsigned char)sudoerstext[n]); n++)
continue;
n += sizeof("Defaults") - 1;
- if ((deftype = yytext[n++]) != '\0') {
- while (isblank((unsigned char)yytext[n]))
+ if ((deftype = sudoerstext[n++]) != '\0') {
+ while (isblank((unsigned char)sudoerstext[n]))
n++;
}
BEGIN GOTDEFS;
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 347 "toke.l"
+#line 348 "toke.l"
{
int n;
LEXRETURN(ERROR);
}
- for (n = 0; isblank((unsigned char)yytext[n]); n++)
+ for (n = 0; isblank((unsigned char)sudoerstext[n]); n++)
continue;
- switch (yytext[n]) {
+ switch (sudoerstext[n]) {
case 'H':
LEXTRACE("HOSTALIAS ");
LEXRETURN(HOSTALIAS);
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 373 "toke.l"
+#line 374 "toke.l"
{
/* cmnd does not require passwd for this user */
LEXTRACE("NOPASSWD ");
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 379 "toke.l"
+#line 380 "toke.l"
{
/* cmnd requires passwd for this user */
LEXTRACE("PASSWD ");
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 385 "toke.l"
+#line 386 "toke.l"
{
LEXTRACE("NOEXEC ");
LEXRETURN(NOEXEC);
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 390 "toke.l"
+#line 391 "toke.l"
{
LEXTRACE("EXEC ");
LEXRETURN(EXEC);
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 395 "toke.l"
+#line 396 "toke.l"
{
LEXTRACE("SETENV ");
LEXRETURN(SETENV);
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 400 "toke.l"
+#line 401 "toke.l"
{
LEXTRACE("NOSETENV ");
LEXRETURN(NOSETENV);
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 405 "toke.l"
+#line 406 "toke.l"
{
LEXTRACE("LOG_OUTPUT ");
LEXRETURN(LOG_OUTPUT);
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 410 "toke.l"
+#line 411 "toke.l"
{
LEXTRACE("NOLOG_OUTPUT ");
LEXRETURN(NOLOG_OUTPUT);
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 415 "toke.l"
+#line 416 "toke.l"
{
LEXTRACE("LOG_INPUT ");
LEXRETURN(LOG_INPUT);
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 420 "toke.l"
+#line 421 "toke.l"
{
LEXTRACE("NOLOG_INPUT ");
LEXRETURN(NOLOG_INPUT);
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 425 "toke.l"
+#line 426 "toke.l"
{
/* empty group or netgroup */
LEXTRACE("ERROR ");
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 431 "toke.l"
+#line 432 "toke.l"
{
/* netgroup */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NETGROUP ");
LEXRETURN(NETGROUP);
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 439 "toke.l"
+#line 440 "toke.l"
{
/* group */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("USERGROUP ");
LEXRETURN(USERGROUP);
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 447 "toke.l"
+#line 448 "toke.l"
{
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 454 "toke.l"
+#line 455 "toke.l"
{
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 461 "toke.l"
+#line 462 "toke.l"
{
- if (!ipv6_valid(yytext)) {
+ if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
}
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 472 "toke.l"
+#line 473 "toke.l"
{
- if (!ipv6_valid(yytext)) {
+ if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
}
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 483 "toke.l"
+#line 484 "toke.l"
{
LEXTRACE("ALL ");
LEXRETURN(ALL);
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 489 "toke.l"
+#line 490 "toke.l"
{
#ifdef HAVE_SELINUX
LEXTRACE("ROLE ");
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 498 "toke.l"
+#line 499 "toke.l"
{
#ifdef HAVE_SELINUX
LEXTRACE("TYPE ");
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 506 "toke.l"
+#line 507 "toke.l"
{
#ifdef HAVE_PRIV_SET
LEXTRACE("PRIVS ");
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 515 "toke.l"
+#line 516 "toke.l"
{
#ifdef HAVE_PRIV_SET
LEXTRACE("LIMITPRIVS ");
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 524 "toke.l"
+#line 525 "toke.l"
{
got_alias:
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("ALIAS ");
LEXRETURN(ALIAS);
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 532 "toke.l"
+#line 533 "toke.l"
{
/* no command args allowed for Defaults!/path */
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("COMMAND ");
LEXRETURN(COMMAND);
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 540 "toke.l"
+#line 541 "toke.l"
{
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
} /* sudo -e */
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 547 "toke.l"
+#line 548 "toke.l"
{
/* directories can't have args... */
- if (yytext[yyleng - 1] == '/') {
+ if (sudoerstext[sudoersleng - 1] == '/') {
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(COMMAND);
} else {
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
}
} /* a pathname */
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 562 "toke.l"
+#line 563 "toke.l"
{
LEXTRACE("BEGINSTR ");
- yylval.string = NULL;
+ sudoerslval.string = NULL;
prev_state = YY_START;
BEGIN INSTR;
}
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 569 "toke.l"
+#line 570 "toke.l"
{
/* a word */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("WORD(5) ");
LEXRETURN(WORD);
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 577 "toke.l"
+#line 578 "toke.l"
{
LEXTRACE("( ");
LEXRETURN('(');
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 582 "toke.l"
+#line 583 "toke.l"
{
LEXTRACE(") ");
LEXRETURN(')');
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 587 "toke.l"
+#line 588 "toke.l"
{
LEXTRACE(", ");
LEXRETURN(',');
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 592 "toke.l"
+#line 593 "toke.l"
{
LEXTRACE("= ");
LEXRETURN('=');
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 597 "toke.l"
+#line 598 "toke.l"
{
LEXTRACE(": ");
LEXRETURN(':');
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 602 "toke.l"
+#line 603 "toke.l"
{
- if (yyleng & 1) {
+ if (sudoersleng & 1) {
LEXTRACE("!");
LEXRETURN('!'); /* return '!' */
}
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 609 "toke.l"
+#line 610 "toke.l"
{
if (YY_START == INSTR) {
LEXTRACE("ERROR ");
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 621 "toke.l"
+#line 622 "toke.l"
{ /* throw away space/tabs */
sawspace = true; /* but remember for fill_args */
}
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 625 "toke.l"
+#line 626 "toke.l"
{
sawspace = true; /* remember for fill_args */
sudolineno++;
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 631 "toke.l"
+#line 632 "toke.l"
{
BEGIN INITIAL;
sudolineno++;
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 639 "toke.l"
+#line 640 "toke.l"
{
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
case YY_STATE_EOF(STARTDEFS):
case YY_STATE_EOF(INDEFS):
case YY_STATE_EOF(INSTR):
-#line 644 "toke.l"
+#line 645 "toke.l"
{
if (YY_START != INITIAL) {
BEGIN INITIAL;
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 654 "toke.l"
+#line 655 "toke.l"
ECHO;
YY_BREAK
-#line 2468 "lex.yy.c"
+#line 2485 "lex.sudoers.c"
case YY_END_OF_BUFFER:
{
return 0;
}
#endif
-#line 654 "toke.l"
+#line 655 "toke.l"
struct path_list {
char *path;
if (errno != ENOENT) {
char *errbuf;
if (asprintf(&errbuf, _("%s: %s"), dirpath, strerror(errno)) != -1) {
- yyerror(errbuf);
+ sudoerserror(errbuf);
free(errbuf);
} else {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
}
}
goto done;
efree(istack[idepth].path);
if (idepth && !istack[idepth].keepopen)
fclose(istack[idepth].bs->yy_input_file);
- yy_delete_buffer(istack[idepth].bs);
+ sudoers_delete_buffer(istack[idepth].bs);
}
efree(istack);
istack = NULL;
/* push current state onto stack */
if (idepth >= istacksize) {
if (idepth > MAX_SUDOERS_DEPTH) {
- yyerror(_("too many levels of includes"));
+ sudoerserror(_("too many levels of includes"));
debug_return_bool(false);
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
sizeof(*istack) * istacksize);
if (istack == NULL) {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
debug_return_bool(false);
}
}
debug_return_bool(false);
}
if (!(path = switch_dir(&istack[idepth], path))) {
- /* switch_dir() called yyerror() for us */
+ /* switch_dir() called sudoerserror() for us */
debug_return_bool(false);
}
while ((fp = open_sudoers(path, false, &keepopen)) == NULL) {
} else {
if ((fp = open_sudoers(path, true, &keepopen)) == NULL) {
/* The error was already printed by open_sudoers() */
- yyerror(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
istack[idepth].more = NULL;
idepth++;
sudolineno = 1;
sudoers = path;
- yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
+ sudoers_switch_to_buffer(sudoers_create_buffer(fp, YY_BUF_SIZE));
debug_return_bool(true);
}
if (!keepopen)
fclose(YY_CURRENT_BUFFER->yy_input_file);
- yy_delete_buffer(YY_CURRENT_BUFFER);
+ sudoers_delete_buffer(YY_CURRENT_BUFFER);
/* If we are in an include dir, move to the next file. */
while ((pl = istack[idepth - 1].more) != NULL) {
fp = open_sudoers(pl->path, false, &keepopen);
efree(sudoers);
sudoers = pl->path;
sudolineno = 1;
- yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
+ sudoers_switch_to_buffer(sudoers_create_buffer(fp, YY_BUF_SIZE));
efree(pl);
break;
}
/* If no path list, just pop the last dir on the stack. */
if (pl == NULL) {
idepth--;
- yy_switch_to_buffer(istack[idepth].bs);
+ sudoers_switch_to_buffer(istack[idepth].bs);
efree(sudoers);
sudoers = istack[idepth].path;
sudolineno = istack[idepth].lineno;
len += (int)(ep - cp);
path = pp = malloc(len + dirlen + 1);
if (path == NULL) {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
debug_return_str(NULL);
}
if (dirlen) {
bool fill_txt(const char *, int, int);
bool ipv6_valid(const char *s);
int sudoers_trace_print(const char *msg);
-void yyerror(const char *);
+void sudoerserror(const char *);
#ifndef FLEX_SCANNER
extern int (*trace_print)(const char *msg);
#include "lbuf.h"
#include "secure_path.h"
-extern YYSTYPE yylval;
+extern YYSTYPE sudoerslval;
extern bool parse_error;
extern bool sudoers_warnings;
int sudolineno;
return (n); \
} while (0)
-#define ECHO ignore_result(fwrite(yytext, yyleng, 1, yyout))
+#define ECHO ignore_result(fwrite(sudoerstext, sudoersleng, 1, sudoersout))
#define push_include(_p) (_push_include((_p), false))
#define push_includedir(_p) (_push_include((_p), true))
%option noinput
%option nounput
%option noyywrap
+%option prefix="sudoers"
%s GOTDEFS
%x GOTCMND
<STARTDEFS>{DEFVAR} {
BEGIN INDEFS;
LEXTRACE("DEFVAR ");
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(DEFVAR);
}
\" {
LEXTRACE("BEGINSTR ");
- yylval.string = NULL;
+ sudoerslval.string = NULL;
prev_state = YY_START;
BEGIN INSTR;
}
{ENVAR} {
LEXTRACE("WORD(2) ");
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(WORD);
}
LEXTRACE("ENDSTR ");
BEGIN prev_state;
- if (yylval.string == NULL) {
+ if (sudoerslval.string == NULL) {
LEXTRACE("ERROR "); /* empty string */
LEXRETURN(ERROR);
}
if (prev_state == INITIAL) {
- switch (yylval.string[0]) {
+ switch (sudoerslval.string[0]) {
case '%':
- if (yylval.string[1] == '\0' ||
- (yylval.string[1] == ':' &&
- yylval.string[2] == '\0')) {
+ if (sudoerslval.string[1] == '\0' ||
+ (sudoerslval.string[1] == ':' &&
+ sudoerslval.string[2] == '\0')) {
LEXTRACE("ERROR "); /* empty group */
LEXRETURN(ERROR);
}
LEXTRACE("USERGROUP ");
LEXRETURN(USERGROUP);
case '+':
- if (yylval.string[1] == '\0') {
+ if (sudoerslval.string[1] == '\0') {
LEXTRACE("ERROR "); /* empty netgroup */
LEXRETURN(ERROR);
}
\\ {
LEXTRACE("BACKSLASH ");
- if (!append(yytext, yyleng))
+ if (!append(sudoerstext, sudoersleng))
yyterminate();
}
([^\"\n\\]|\\\")+ {
LEXTRACE("STRBODY ");
- if (!append(yytext, yyleng))
+ if (!append(sudoerstext, sudoersleng))
yyterminate();
}
}
\\[\*\?\[\]\!] {
/* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR ");
- if (!fill_args(yytext, 2, sawspace))
+ if (!fill_args(sudoerstext, 2, sawspace))
yyterminate();
sawspace = false;
}
\\[:\\,= \t#] {
/* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR ");
- if (!fill_args(yytext + 1, 1, sawspace))
+ if (!fill_args(sudoerstext + 1, 1, sawspace))
yyterminate();
sawspace = false;
}
[^#\\:, \t\n]+ {
LEXTRACE("ARG ");
- if (!fill_args(yytext, yyleng, sawspace))
+ if (!fill_args(sudoerstext, sudoersleng, sawspace))
yyterminate();
sawspace = false;
} /* a command line arg */
LEXRETURN(ERROR);
}
- if ((path = parse_include(yytext)) == NULL)
+ if ((path = parse_include(sudoerstext)) == NULL)
yyterminate();
LEXTRACE("INCLUDE\n");
LEXRETURN(ERROR);
}
- if ((path = parse_include(yytext)) == NULL)
+ if ((path = parse_include(sudoerstext)) == NULL)
yyterminate();
LEXTRACE("INCLUDEDIR\n");
LEXRETURN(ERROR);
}
- for (n = 0; isblank((unsigned char)yytext[n]); n++)
+ for (n = 0; isblank((unsigned char)sudoerstext[n]); n++)
continue;
n += sizeof("Defaults") - 1;
- if ((deftype = yytext[n++]) != '\0') {
- while (isblank((unsigned char)yytext[n]))
+ if ((deftype = sudoerstext[n++]) != '\0') {
+ while (isblank((unsigned char)sudoerstext[n]))
n++;
}
BEGIN GOTDEFS;
LEXRETURN(ERROR);
}
- for (n = 0; isblank((unsigned char)yytext[n]); n++)
+ for (n = 0; isblank((unsigned char)sudoerstext[n]); n++)
continue;
- switch (yytext[n]) {
+ switch (sudoerstext[n]) {
case 'H':
LEXTRACE("HOSTALIAS ");
LEXRETURN(HOSTALIAS);
\+{WORD} {
/* netgroup */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NETGROUP ");
LEXRETURN(NETGROUP);
\%:?({WORD}|{ID}) {
/* group */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("USERGROUP ");
LEXRETURN(USERGROUP);
}
{IPV4ADDR}(\/{IPV4ADDR})? {
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
}
{IPV4ADDR}\/([12]?[0-9]|3[0-2]) {
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
}
{IPV6ADDR}(\/{IPV6ADDR})? {
- if (!ipv6_valid(yytext)) {
+ if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
}
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
}
{IPV6ADDR}\/([0-9]|[1-9][0-9]|1[01][0-9]|12[0-8]) {
- if (!ipv6_valid(yytext)) {
+ if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR ");
LEXRETURN(ERROR);
}
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("NTWKADDR ");
LEXRETURN(NTWKADDR);
[[:upper:]][[:upper:][:digit:]_]* {
got_alias:
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("ALIAS ");
LEXRETURN(ALIAS);
<GOTDEFS>({PATH}|sudoedit) {
/* no command args allowed for Defaults!/path */
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("COMMAND ");
LEXRETURN(COMMAND);
sudoedit {
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
} /* sudo -e */
{PATH} {
/* directories can't have args... */
- if (yytext[yyleng - 1] == '/') {
+ if (sudoerstext[sudoersleng - 1] == '/') {
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
LEXRETURN(COMMAND);
} else {
BEGIN GOTCMND;
LEXTRACE("COMMAND ");
- if (!fill_cmnd(yytext, yyleng))
+ if (!fill_cmnd(sudoerstext, sudoersleng))
yyterminate();
}
} /* a pathname */
<INITIAL,GOTDEFS>\" {
LEXTRACE("BEGINSTR ");
- yylval.string = NULL;
+ sudoerslval.string = NULL;
prev_state = YY_START;
BEGIN INSTR;
}
<INITIAL,GOTDEFS>({ID}|{WORD}) {
/* a word */
- if (!fill(yytext, yyleng))
+ if (!fill(sudoerstext, sudoersleng))
yyterminate();
LEXTRACE("WORD(5) ");
LEXRETURN(WORD);
} /* return ':' */
<*>!+ {
- if (yyleng & 1) {
+ if (sudoersleng & 1) {
LEXTRACE("!");
LEXRETURN('!'); /* return '!' */
}
if (errno != ENOENT) {
char *errbuf;
if (asprintf(&errbuf, _("%s: %s"), dirpath, strerror(errno)) != -1) {
- yyerror(errbuf);
+ sudoerserror(errbuf);
free(errbuf);
} else {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
}
}
goto done;
efree(istack[idepth].path);
if (idepth && !istack[idepth].keepopen)
fclose(istack[idepth].bs->yy_input_file);
- yy_delete_buffer(istack[idepth].bs);
+ sudoers_delete_buffer(istack[idepth].bs);
}
efree(istack);
istack = NULL;
/* push current state onto stack */
if (idepth >= istacksize) {
if (idepth > MAX_SUDOERS_DEPTH) {
- yyerror(_("too many levels of includes"));
+ sudoerserror(_("too many levels of includes"));
debug_return_bool(false);
}
istacksize += SUDOERS_STACK_INCREMENT;
istack = (struct include_stack *) realloc(istack,
sizeof(*istack) * istacksize);
if (istack == NULL) {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
debug_return_bool(false);
}
}
debug_return_bool(false);
}
if (!(path = switch_dir(&istack[idepth], path))) {
- /* switch_dir() called yyerror() for us */
+ /* switch_dir() called sudoerserror() for us */
debug_return_bool(false);
}
while ((fp = open_sudoers(path, false, &keepopen)) == NULL) {
} else {
if ((fp = open_sudoers(path, true, &keepopen)) == NULL) {
/* The error was already printed by open_sudoers() */
- yyerror(NULL);
+ sudoerserror(NULL);
debug_return_bool(false);
}
istack[idepth].more = NULL;
idepth++;
sudolineno = 1;
sudoers = path;
- yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
+ sudoers_switch_to_buffer(sudoers_create_buffer(fp, YY_BUF_SIZE));
debug_return_bool(true);
}
if (!keepopen)
fclose(YY_CURRENT_BUFFER->yy_input_file);
- yy_delete_buffer(YY_CURRENT_BUFFER);
+ sudoers_delete_buffer(YY_CURRENT_BUFFER);
/* If we are in an include dir, move to the next file. */
while ((pl = istack[idepth - 1].more) != NULL) {
fp = open_sudoers(pl->path, false, &keepopen);
efree(sudoers);
sudoers = pl->path;
sudolineno = 1;
- yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE));
+ sudoers_switch_to_buffer(sudoers_create_buffer(fp, YY_BUF_SIZE));
efree(pl);
break;
}
/* If no path list, just pop the last dir on the stack. */
if (pl == NULL) {
idepth--;
- yy_switch_to_buffer(istack[idepth].bs);
+ sudoers_switch_to_buffer(istack[idepth].bs);
efree(sudoers);
sudoers = istack[idepth].path;
sudolineno = istack[idepth].lineno;
len += (int)(ep - cp);
path = pp = malloc(len + dirlen + 1);
if (path == NULL) {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
debug_return_str(NULL);
}
if (dirlen) {
char *dst;
debug_decl(fill_txt, SUDO_DEBUG_PARSER)
- dst = olen ? realloc(yylval.string, olen + len + 1) : malloc(len + 1);
+ dst = olen ? realloc(sudoerslval.string, olen + len + 1) : malloc(len + 1);
if (dst == NULL) {
- yyerror(_("unable to allocate memory"));
+ sudoerserror(_("unable to allocate memory"));
debug_return_bool(false);
}
- yylval.string = dst;
+ sudoerslval.string = dst;
/* Copy the string and collapse any escaped characters. */
dst += olen;
int olen = 0;
debug_decl(append, SUDO_DEBUG_PARSER)
- if (yylval.string != NULL)
- olen = strlen(yylval.string);
+ if (sudoerslval.string != NULL)
+ olen = strlen(sudoerslval.string);
debug_return_bool(fill_txt(src, len, olen));
}
arg_len = arg_size = 0;
- dst = yylval.command.cmnd = (char *) malloc(len + 1);
- if (yylval.command.cmnd == NULL) {
- yyerror(_("unable to allocate memory"));
+ dst = sudoerslval.command.cmnd = (char *) malloc(len + 1);
+ if (sudoerslval.command.cmnd == NULL) {
+ sudoerserror(_("unable to allocate memory"));
debug_return_bool(false);
}
}
*dst = '\0';
- yylval.command.args = NULL;
+ sudoerslval.command.args = NULL;
debug_return_bool(true);
}
char *p;
debug_decl(fill_args, SUDO_DEBUG_PARSER)
- if (yylval.command.args == NULL) {
+ if (sudoerslval.command.args == NULL) {
addspace = 0;
new_len = len;
} else
while (new_len >= (arg_size += COMMANDARGINC))
;
- p = yylval.command.args ?
- (char *) realloc(yylval.command.args, arg_size) :
+ p = sudoerslval.command.args ?
+ (char *) realloc(sudoerslval.command.args, arg_size) :
(char *) malloc(arg_size);
if (p == NULL) {
- efree(yylval.command.args);
- yyerror(_("unable to allocate memory"));
+ efree(sudoerslval.command.args);
+ sudoerserror(_("unable to allocate memory"));
debug_return_bool(false);
} else
- yylval.command.args = p;
+ sudoerslval.command.args = p;
}
/* Efficiently append the arg (with a leading space if needed). */
- p = yylval.command.args + arg_len;
+ p = sudoerslval.command.args + arg_len;
if (addspace)
*p++ = ' ';
- if (strlcpy(p, s, arg_size - (p - yylval.command.args)) != len) {
- yyerror(_("fill_args: buffer overflow")); /* paranoia */
+ if (strlcpy(p, s, arg_size - (p - sudoerslval.command.args)) != len) {
+ sudoerserror(_("fill_args: buffer overflow")); /* paranoia */
debug_return_bool(false);
}
arg_len = new_len;
void cleanup(int);
-extern void yyerror(const char *);
-extern void yyrestart(FILE *);
+extern void sudoerserror(const char *);
+extern void sudoersrestart(FILE *);
/*
* External globals exported by the parser
*/
extern struct rbtree *aliases;
-extern FILE *yyin;
+extern FILE *sudoersin;
extern char *sudoers, *errorfile;
extern int errorlineno;
extern bool parse_error;
* Parse the existing sudoers file(s) in quiet mode to highlight any
* existing errors and to pull in editor and env_editor conf values.
*/
- if ((yyin = open_sudoers(sudoers_path, true, NULL)) == NULL) {
+ if ((sudoersin = open_sudoers(sudoers_path, true, NULL)) == NULL) {
error(1, "%s", sudoers_path);
}
init_parser(sudoers_path, false);
- yyparse();
+ sudoersparse();
(void) update_defaults(SETDEF_GENERIC|SETDEF_HOST|SETDEF_USER);
editor = get_editor(&args);
init_parser(sp->path, quiet);
/* Parse the sudoers temp file */
- yyrestart(fp);
- if (yyparse() && !parse_error) {
+ sudoersrestart(fp);
+ if (sudoersparse() && !parse_error) {
warningx(_("unabled to parse temporary file (%s), unknown error"),
sp->tpath);
parse_error = true;
errorfile = sp->path;
}
- fclose(yyin);
+ fclose(sudoersin);
if (!parse_error) {
if (!check_defaults(SETDEF_ALL, quiet) ||
check_aliases(strict, quiet) != 0) {
debug_decl(check_syntax, SUDO_DEBUG_UTIL)
if (strcmp(sudoers_path, "-") == 0) {
- yyin = stdin;
+ sudoersin = stdin;
sudoers_path = "stdin";
- } else if ((yyin = fopen(sudoers_path, "r")) == NULL) {
+ } else if ((sudoersin = fopen(sudoers_path, "r")) == NULL) {
if (!quiet)
warning(_("unable to open %s"), sudoers_path);
goto done;
}
init_parser(sudoers_path, quiet);
- if (yyparse() && !parse_error) {
+ if (sudoersparse() && !parse_error) {
if (!quiet)
warningx(_("failed to parse %s file, unknown error"), sudoers_path);
parse_error = true;