Move symbol extern defs into sudoers.h

This commit is contained in:
Todd C. Miller
2013-12-16 14:18:42 -07:00
parent 624f4fdb13
commit b2c456341a
12 changed files with 192 additions and 231 deletions

View File

@@ -54,8 +54,6 @@
# define LOGIN_DEFROOTCLASS "daemon" # define LOGIN_DEFROOTCLASS "daemon"
# endif # endif
extern char *login_style; /* from sudoers.c */
struct bsdauth_state { struct bsdauth_state {
auth_session_t *as; auth_session_t *as;
login_cap_t *lc; login_cap_t *lc;

View File

@@ -109,13 +109,10 @@
/* /*
* Globals * Globals
*/ */
extern int sudolineno;
extern int last_token;
extern char *sudoers;
bool sudoers_warnings = true; bool sudoers_warnings = true;
bool parse_error = false; bool parse_error = false;
int errorlineno = -1; int errorlineno = -1;
char *errorfile = NULL; const char *errorfile = NULL;
struct defaults_list defaults = TAILQ_HEAD_INITIALIZER(defaults); struct defaults_list defaults = TAILQ_HEAD_INITIALIZER(defaults);
struct userspec_list userspecs = TAILQ_HEAD_INITIALIZER(userspecs); struct userspec_list userspecs = TAILQ_HEAD_INITIALIZER(userspecs);
@@ -128,7 +125,7 @@ static void add_userspec(struct member *, struct privilege *);
static struct defaults *new_default(char *, char *, int); static struct defaults *new_default(char *, char *, int);
static struct member *new_member(char *, int); static struct member *new_member(char *, int);
static struct sudo_digest *new_digest(int, const char *); static struct sudo_digest *new_digest(int, const char *);
#line 95 "gram.y" #line 92 "gram.y"
#ifndef YYSTYPE_DEFINED #ifndef YYSTYPE_DEFINED
#define YYSTYPE_DEFINED #define YYSTYPE_DEFINED
typedef union { typedef union {
@@ -146,7 +143,7 @@ typedef union {
int tok; int tok;
} YYSTYPE; } YYSTYPE;
#endif /* YYSTYPE_DEFINED */ #endif /* YYSTYPE_DEFINED */
#line 149 "gram.c" #line 146 "gram.c"
#define COMMAND 257 #define COMMAND 257
#define ALIAS 258 #define ALIAS 258
#define DEFVAR 259 #define DEFVAR 259
@@ -699,7 +696,7 @@ short *yyss;
short *yysslim; short *yysslim;
YYSTYPE *yyvs; YYSTYPE *yyvs;
unsigned int yystacksize; unsigned int yystacksize;
#line 688 "gram.y" #line 685 "gram.y"
void void
sudoerserror(const char *s) sudoerserror(const char *s)
{ {
@@ -958,7 +955,7 @@ init_parser(const char *path, bool quiet)
debug_return; debug_return;
} }
#line 909 "gram.c" #line 906 "gram.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */ /* allocate initial stack or double stack size, up to YYMAXDEPTH */
#if defined(__cplusplus) || defined(__STDC__) #if defined(__cplusplus) || defined(__STDC__)
static int yygrowstack(void) static int yygrowstack(void)
@@ -1167,127 +1164,127 @@ yyreduce:
switch (yyn) switch (yyn)
{ {
case 1: case 1:
#line 185 "gram.y" #line 182 "gram.y"
{ ; } { ; }
break; break;
case 5: case 5:
#line 193 "gram.y" #line 190 "gram.y"
{ {
; ;
} }
break; break;
case 6: case 6:
#line 196 "gram.y" #line 193 "gram.y"
{ {
yyerrok; yyerrok;
} }
break; break;
case 7: case 7:
#line 199 "gram.y" #line 196 "gram.y"
{ {
add_userspec(yyvsp[-1].member, yyvsp[0].privilege); add_userspec(yyvsp[-1].member, yyvsp[0].privilege);
} }
break; break;
case 8: case 8:
#line 202 "gram.y" #line 199 "gram.y"
{ {
; ;
} }
break; break;
case 9: case 9:
#line 205 "gram.y" #line 202 "gram.y"
{ {
; ;
} }
break; break;
case 10: case 10:
#line 208 "gram.y" #line 205 "gram.y"
{ {
; ;
} }
break; break;
case 11: case 11:
#line 211 "gram.y" #line 208 "gram.y"
{ {
; ;
} }
break; break;
case 12: case 12:
#line 214 "gram.y" #line 211 "gram.y"
{ {
add_defaults(DEFAULTS, NULL, yyvsp[0].defaults); add_defaults(DEFAULTS, NULL, yyvsp[0].defaults);
} }
break; break;
case 13: case 13:
#line 217 "gram.y" #line 214 "gram.y"
{ {
add_defaults(DEFAULTS_USER, yyvsp[-1].member, yyvsp[0].defaults); add_defaults(DEFAULTS_USER, yyvsp[-1].member, yyvsp[0].defaults);
} }
break; break;
case 14: case 14:
#line 220 "gram.y" #line 217 "gram.y"
{ {
add_defaults(DEFAULTS_RUNAS, yyvsp[-1].member, yyvsp[0].defaults); add_defaults(DEFAULTS_RUNAS, yyvsp[-1].member, yyvsp[0].defaults);
} }
break; break;
case 15: case 15:
#line 223 "gram.y" #line 220 "gram.y"
{ {
add_defaults(DEFAULTS_HOST, yyvsp[-1].member, yyvsp[0].defaults); add_defaults(DEFAULTS_HOST, yyvsp[-1].member, yyvsp[0].defaults);
} }
break; break;
case 16: case 16:
#line 226 "gram.y" #line 223 "gram.y"
{ {
add_defaults(DEFAULTS_CMND, yyvsp[-1].member, yyvsp[0].defaults); add_defaults(DEFAULTS_CMND, yyvsp[-1].member, yyvsp[0].defaults);
} }
break; break;
case 18: case 18:
#line 232 "gram.y" #line 229 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].defaults, yyvsp[0].defaults, entries); HLTQ_CONCAT(yyvsp[-2].defaults, yyvsp[0].defaults, entries);
yyval.defaults = yyvsp[-2].defaults; yyval.defaults = yyvsp[-2].defaults;
} }
break; break;
case 19: case 19:
#line 238 "gram.y" #line 235 "gram.y"
{ {
yyval.defaults = new_default(yyvsp[0].string, NULL, true); yyval.defaults = new_default(yyvsp[0].string, NULL, true);
} }
break; break;
case 20: case 20:
#line 241 "gram.y" #line 238 "gram.y"
{ {
yyval.defaults = new_default(yyvsp[0].string, NULL, false); yyval.defaults = new_default(yyvsp[0].string, NULL, false);
} }
break; break;
case 21: case 21:
#line 244 "gram.y" #line 241 "gram.y"
{ {
yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, true); yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, true);
} }
break; break;
case 22: case 22:
#line 247 "gram.y" #line 244 "gram.y"
{ {
yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '+'); yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '+');
} }
break; break;
case 23: case 23:
#line 250 "gram.y" #line 247 "gram.y"
{ {
yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '-'); yyval.defaults = new_default(yyvsp[-2].string, yyvsp[0].string, '-');
} }
break; break;
case 25: case 25:
#line 256 "gram.y" #line 253 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].privilege, yyvsp[0].privilege, entries); HLTQ_CONCAT(yyvsp[-2].privilege, yyvsp[0].privilege, entries);
yyval.privilege = yyvsp[-2].privilege; yyval.privilege = yyvsp[-2].privilege;
} }
break; break;
case 26: case 26:
#line 262 "gram.y" #line 259 "gram.y"
{ {
struct privilege *p = ecalloc(1, sizeof(*p)); struct privilege *p = ecalloc(1, sizeof(*p));
HLTQ_TO_TAILQ(&p->hostlist, yyvsp[-2].member, entries); HLTQ_TO_TAILQ(&p->hostlist, yyvsp[-2].member, entries);
@@ -1297,51 +1294,51 @@ case 26:
} }
break; break;
case 27: case 27:
#line 271 "gram.y" #line 268 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = false; yyval.member->negated = false;
} }
break; break;
case 28: case 28:
#line 275 "gram.y" #line 272 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = true; yyval.member->negated = true;
} }
break; break;
case 29: case 29:
#line 281 "gram.y" #line 278 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, ALIAS); yyval.member = new_member(yyvsp[0].string, ALIAS);
} }
break; break;
case 30: case 30:
#line 284 "gram.y" #line 281 "gram.y"
{ {
yyval.member = new_member(NULL, ALL); yyval.member = new_member(NULL, ALL);
} }
break; break;
case 31: case 31:
#line 287 "gram.y" #line 284 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, NETGROUP); yyval.member = new_member(yyvsp[0].string, NETGROUP);
} }
break; break;
case 32: case 32:
#line 290 "gram.y" #line 287 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, NTWKADDR); yyval.member = new_member(yyvsp[0].string, NTWKADDR);
} }
break; break;
case 33: case 33:
#line 293 "gram.y" #line 290 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, WORD); yyval.member = new_member(yyvsp[0].string, WORD);
} }
break; break;
case 35: case 35:
#line 299 "gram.y" #line 296 "gram.y"
{ {
struct cmndspec *prev; struct cmndspec *prev;
prev = HLTQ_LAST(yyvsp[-2].cmndspec, cmndspec, entries); prev = HLTQ_LAST(yyvsp[-2].cmndspec, cmndspec, entries);
@@ -1383,7 +1380,7 @@ case 35:
} }
break; break;
case 36: case 36:
#line 340 "gram.y" #line 337 "gram.y"
{ {
struct cmndspec *cs = ecalloc(1, sizeof(*cs)); struct cmndspec *cs = ecalloc(1, sizeof(*cs));
if (yyvsp[-4].runas != NULL) { if (yyvsp[-4].runas != NULL) {
@@ -1420,37 +1417,37 @@ case 36:
} }
break; break;
case 37: case 37:
#line 376 "gram.y" #line 373 "gram.y"
{ {
yyval.digest = new_digest(SUDO_DIGEST_SHA224, yyvsp[0].string); yyval.digest = new_digest(SUDO_DIGEST_SHA224, yyvsp[0].string);
} }
break; break;
case 38: case 38:
#line 379 "gram.y" #line 376 "gram.y"
{ {
yyval.digest = new_digest(SUDO_DIGEST_SHA256, yyvsp[0].string); yyval.digest = new_digest(SUDO_DIGEST_SHA256, yyvsp[0].string);
} }
break; break;
case 39: case 39:
#line 382 "gram.y" #line 379 "gram.y"
{ {
yyval.digest = new_digest(SUDO_DIGEST_SHA384, yyvsp[0].string); yyval.digest = new_digest(SUDO_DIGEST_SHA384, yyvsp[0].string);
} }
break; break;
case 40: case 40:
#line 385 "gram.y" #line 382 "gram.y"
{ {
yyval.digest = new_digest(SUDO_DIGEST_SHA512, yyvsp[0].string); yyval.digest = new_digest(SUDO_DIGEST_SHA512, yyvsp[0].string);
} }
break; break;
case 41: case 41:
#line 390 "gram.y" #line 387 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
} }
break; break;
case 42: case 42:
#line 393 "gram.y" #line 390 "gram.y"
{ {
/* XXX - yuck */ /* XXX - yuck */
struct sudo_command *c = (struct sudo_command *)(yyvsp[0].member->name); struct sudo_command *c = (struct sudo_command *)(yyvsp[0].member->name);
@@ -1459,127 +1456,127 @@ case 42:
} }
break; break;
case 43: case 43:
#line 401 "gram.y" #line 398 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = false; yyval.member->negated = false;
} }
break; break;
case 44: case 44:
#line 405 "gram.y" #line 402 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = true; yyval.member->negated = true;
} }
break; break;
case 45: case 45:
#line 411 "gram.y" #line 408 "gram.y"
{ {
yyval.string = yyvsp[0].string; yyval.string = yyvsp[0].string;
} }
break; break;
case 46: case 46:
#line 416 "gram.y" #line 413 "gram.y"
{ {
yyval.string = yyvsp[0].string; yyval.string = yyvsp[0].string;
} }
break; break;
case 47: case 47:
#line 421 "gram.y" #line 418 "gram.y"
{ {
yyval.seinfo.role = NULL; yyval.seinfo.role = NULL;
yyval.seinfo.type = NULL; yyval.seinfo.type = NULL;
} }
break; break;
case 48: case 48:
#line 425 "gram.y" #line 422 "gram.y"
{ {
yyval.seinfo.role = yyvsp[0].string; yyval.seinfo.role = yyvsp[0].string;
yyval.seinfo.type = NULL; yyval.seinfo.type = NULL;
} }
break; break;
case 49: case 49:
#line 429 "gram.y" #line 426 "gram.y"
{ {
yyval.seinfo.type = yyvsp[0].string; yyval.seinfo.type = yyvsp[0].string;
yyval.seinfo.role = NULL; yyval.seinfo.role = NULL;
} }
break; break;
case 50: case 50:
#line 433 "gram.y" #line 430 "gram.y"
{ {
yyval.seinfo.role = yyvsp[-1].string; yyval.seinfo.role = yyvsp[-1].string;
yyval.seinfo.type = yyvsp[0].string; yyval.seinfo.type = yyvsp[0].string;
} }
break; break;
case 51: case 51:
#line 437 "gram.y" #line 434 "gram.y"
{ {
yyval.seinfo.type = yyvsp[-1].string; yyval.seinfo.type = yyvsp[-1].string;
yyval.seinfo.role = yyvsp[0].string; yyval.seinfo.role = yyvsp[0].string;
} }
break; break;
case 52: case 52:
#line 443 "gram.y" #line 440 "gram.y"
{ {
yyval.string = yyvsp[0].string; yyval.string = yyvsp[0].string;
} }
break; break;
case 53: case 53:
#line 447 "gram.y" #line 444 "gram.y"
{ {
yyval.string = yyvsp[0].string; yyval.string = yyvsp[0].string;
} }
break; break;
case 54: case 54:
#line 452 "gram.y" #line 449 "gram.y"
{ {
yyval.privinfo.privs = NULL; yyval.privinfo.privs = NULL;
yyval.privinfo.limitprivs = NULL; yyval.privinfo.limitprivs = NULL;
} }
break; break;
case 55: case 55:
#line 456 "gram.y" #line 453 "gram.y"
{ {
yyval.privinfo.privs = yyvsp[0].string; yyval.privinfo.privs = yyvsp[0].string;
yyval.privinfo.limitprivs = NULL; yyval.privinfo.limitprivs = NULL;
} }
break; break;
case 56: case 56:
#line 460 "gram.y" #line 457 "gram.y"
{ {
yyval.privinfo.privs = NULL; yyval.privinfo.privs = NULL;
yyval.privinfo.limitprivs = yyvsp[0].string; yyval.privinfo.limitprivs = yyvsp[0].string;
} }
break; break;
case 57: case 57:
#line 464 "gram.y" #line 461 "gram.y"
{ {
yyval.privinfo.privs = yyvsp[-1].string; yyval.privinfo.privs = yyvsp[-1].string;
yyval.privinfo.limitprivs = yyvsp[0].string; yyval.privinfo.limitprivs = yyvsp[0].string;
} }
break; break;
case 58: case 58:
#line 468 "gram.y" #line 465 "gram.y"
{ {
yyval.privinfo.limitprivs = yyvsp[-1].string; yyval.privinfo.limitprivs = yyvsp[-1].string;
yyval.privinfo.privs = yyvsp[0].string; yyval.privinfo.privs = yyvsp[0].string;
} }
break; break;
case 59: case 59:
#line 474 "gram.y" #line 471 "gram.y"
{ {
yyval.runas = NULL; yyval.runas = NULL;
} }
break; break;
case 60: case 60:
#line 477 "gram.y" #line 474 "gram.y"
{ {
yyval.runas = yyvsp[-1].runas; yyval.runas = yyvsp[-1].runas;
} }
break; break;
case 61: case 61:
#line 482 "gram.y" #line 479 "gram.y"
{ {
yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = new_member(NULL, MYSELF); yyval.runas->runasusers = new_member(NULL, MYSELF);
@@ -1587,7 +1584,7 @@ case 61:
} }
break; break;
case 62: case 62:
#line 487 "gram.y" #line 484 "gram.y"
{ {
yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = yyvsp[0].member; yyval.runas->runasusers = yyvsp[0].member;
@@ -1595,7 +1592,7 @@ case 62:
} }
break; break;
case 63: case 63:
#line 492 "gram.y" #line 489 "gram.y"
{ {
yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = yyvsp[-2].member; yyval.runas->runasusers = yyvsp[-2].member;
@@ -1603,7 +1600,7 @@ case 63:
} }
break; break;
case 64: case 64:
#line 497 "gram.y" #line 494 "gram.y"
{ {
yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas = ecalloc(1, sizeof(struct runascontainer));
/* $$->runasusers = NULL; */ /* $$->runasusers = NULL; */
@@ -1611,7 +1608,7 @@ case 64:
} }
break; break;
case 65: case 65:
#line 502 "gram.y" #line 499 "gram.y"
{ {
yyval.runas = ecalloc(1, sizeof(struct runascontainer)); yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = new_member(NULL, MYSELF); yyval.runas->runasusers = new_member(NULL, MYSELF);
@@ -1619,86 +1616,86 @@ case 65:
} }
break; break;
case 66: case 66:
#line 509 "gram.y" #line 506 "gram.y"
{ {
yyval.tag.nopasswd = yyval.tag.noexec = yyval.tag.setenv = yyval.tag.nopasswd = yyval.tag.noexec = yyval.tag.setenv =
yyval.tag.log_input = yyval.tag.log_output = UNSPEC; yyval.tag.log_input = yyval.tag.log_output = UNSPEC;
} }
break; break;
case 67: case 67:
#line 513 "gram.y" #line 510 "gram.y"
{ {
yyval.tag.nopasswd = true; yyval.tag.nopasswd = true;
} }
break; break;
case 68: case 68:
#line 516 "gram.y" #line 513 "gram.y"
{ {
yyval.tag.nopasswd = false; yyval.tag.nopasswd = false;
} }
break; break;
case 69: case 69:
#line 519 "gram.y" #line 516 "gram.y"
{ {
yyval.tag.noexec = true; yyval.tag.noexec = true;
} }
break; break;
case 70: case 70:
#line 522 "gram.y" #line 519 "gram.y"
{ {
yyval.tag.noexec = false; yyval.tag.noexec = false;
} }
break; break;
case 71: case 71:
#line 525 "gram.y" #line 522 "gram.y"
{ {
yyval.tag.setenv = true; yyval.tag.setenv = true;
} }
break; break;
case 72: case 72:
#line 528 "gram.y" #line 525 "gram.y"
{ {
yyval.tag.setenv = false; yyval.tag.setenv = false;
} }
break; break;
case 73: case 73:
#line 531 "gram.y" #line 528 "gram.y"
{ {
yyval.tag.log_input = true; yyval.tag.log_input = true;
} }
break; break;
case 74: case 74:
#line 534 "gram.y" #line 531 "gram.y"
{ {
yyval.tag.log_input = false; yyval.tag.log_input = false;
} }
break; break;
case 75: case 75:
#line 537 "gram.y" #line 534 "gram.y"
{ {
yyval.tag.log_output = true; yyval.tag.log_output = true;
} }
break; break;
case 76: case 76:
#line 540 "gram.y" #line 537 "gram.y"
{ {
yyval.tag.log_output = false; yyval.tag.log_output = false;
} }
break; break;
case 77: case 77:
#line 545 "gram.y" #line 542 "gram.y"
{ {
yyval.member = new_member(NULL, ALL); yyval.member = new_member(NULL, ALL);
} }
break; break;
case 78: case 78:
#line 548 "gram.y" #line 545 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, ALIAS); yyval.member = new_member(yyvsp[0].string, ALIAS);
} }
break; break;
case 79: case 79:
#line 551 "gram.y" #line 548 "gram.y"
{ {
struct sudo_command *c = ecalloc(1, sizeof(*c)); struct sudo_command *c = ecalloc(1, sizeof(*c));
c->cmnd = yyvsp[0].command.cmnd; c->cmnd = yyvsp[0].command.cmnd;
@@ -1707,7 +1704,7 @@ case 79:
} }
break; break;
case 82: case 82:
#line 563 "gram.y" #line 560 "gram.y"
{ {
char *s; char *s;
if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) { if ((s = alias_add(yyvsp[-2].string, HOSTALIAS, yyvsp[0].member)) != NULL) {
@@ -1717,14 +1714,14 @@ case 82:
} }
break; break;
case 84: case 84:
#line 573 "gram.y" #line 570 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries); HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries);
yyval.member = yyvsp[-2].member; yyval.member = yyvsp[-2].member;
} }
break; break;
case 87: case 87:
#line 583 "gram.y" #line 580 "gram.y"
{ {
char *s; char *s;
if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) { if ((s = alias_add(yyvsp[-2].string, CMNDALIAS, yyvsp[0].member)) != NULL) {
@@ -1734,14 +1731,14 @@ case 87:
} }
break; break;
case 89: case 89:
#line 593 "gram.y" #line 590 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries); HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries);
yyval.member = yyvsp[-2].member; yyval.member = yyvsp[-2].member;
} }
break; break;
case 92: case 92:
#line 603 "gram.y" #line 600 "gram.y"
{ {
char *s; char *s;
if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) { if ((s = alias_add(yyvsp[-2].string, RUNASALIAS, yyvsp[0].member)) != NULL) {
@@ -1751,7 +1748,7 @@ case 92:
} }
break; break;
case 95: case 95:
#line 616 "gram.y" #line 613 "gram.y"
{ {
char *s; char *s;
if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) { if ((s = alias_add(yyvsp[-2].string, USERALIAS, yyvsp[0].member)) != NULL) {
@@ -1761,96 +1758,96 @@ case 95:
} }
break; break;
case 97: case 97:
#line 626 "gram.y" #line 623 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries); HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries);
yyval.member = yyvsp[-2].member; yyval.member = yyvsp[-2].member;
} }
break; break;
case 98: case 98:
#line 632 "gram.y" #line 629 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = false; yyval.member->negated = false;
} }
break; break;
case 99: case 99:
#line 636 "gram.y" #line 633 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = true; yyval.member->negated = true;
} }
break; break;
case 100: case 100:
#line 642 "gram.y" #line 639 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, ALIAS); yyval.member = new_member(yyvsp[0].string, ALIAS);
} }
break; break;
case 101: case 101:
#line 645 "gram.y" #line 642 "gram.y"
{ {
yyval.member = new_member(NULL, ALL); yyval.member = new_member(NULL, ALL);
} }
break; break;
case 102: case 102:
#line 648 "gram.y" #line 645 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, NETGROUP); yyval.member = new_member(yyvsp[0].string, NETGROUP);
} }
break; break;
case 103: case 103:
#line 651 "gram.y" #line 648 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, USERGROUP); yyval.member = new_member(yyvsp[0].string, USERGROUP);
} }
break; break;
case 104: case 104:
#line 654 "gram.y" #line 651 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, WORD); yyval.member = new_member(yyvsp[0].string, WORD);
} }
break; break;
case 106: case 106:
#line 660 "gram.y" #line 657 "gram.y"
{ {
HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries); HLTQ_CONCAT(yyvsp[-2].member, yyvsp[0].member, entries);
yyval.member = yyvsp[-2].member; yyval.member = yyvsp[-2].member;
} }
break; break;
case 107: case 107:
#line 666 "gram.y" #line 663 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = false; yyval.member->negated = false;
} }
break; break;
case 108: case 108:
#line 670 "gram.y" #line 667 "gram.y"
{ {
yyval.member = yyvsp[0].member; yyval.member = yyvsp[0].member;
yyval.member->negated = true; yyval.member->negated = true;
} }
break; break;
case 109: case 109:
#line 676 "gram.y" #line 673 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, ALIAS); yyval.member = new_member(yyvsp[0].string, ALIAS);
} }
break; break;
case 110: case 110:
#line 679 "gram.y" #line 676 "gram.y"
{ {
yyval.member = new_member(NULL, ALL); yyval.member = new_member(NULL, ALL);
} }
break; break;
case 111: case 111:
#line 682 "gram.y" #line 679 "gram.y"
{ {
yyval.member = new_member(yyvsp[0].string, WORD); yyval.member = new_member(yyvsp[0].string, WORD);
} }
break; break;
#line 1801 "gram.c" #line 1798 "gram.c"
} }
yyssp -= yym; yyssp -= yym;
yystate = *yyssp; yystate = *yyssp;

View File

@@ -71,13 +71,10 @@
/* /*
* Globals * Globals
*/ */
extern int sudolineno;
extern int last_token;
extern char *sudoers;
bool sudoers_warnings = true; bool sudoers_warnings = true;
bool parse_error = false; bool parse_error = false;
int errorlineno = -1; int errorlineno = -1;
char *errorfile = NULL; const char *errorfile = NULL;
struct defaults_list defaults = TAILQ_HEAD_INITIALIZER(defaults); struct defaults_list defaults = TAILQ_HEAD_INITIALIZER(defaults);
struct userspec_list userspecs = TAILQ_HEAD_INITIALIZER(userspecs); struct userspec_list userspecs = TAILQ_HEAD_INITIALIZER(userspecs);

View File

@@ -63,14 +63,6 @@ struct sudo_nss sudo_nss_file = {
sudo_file_display_privs sudo_file_display_privs
}; };
/*
* Parser externs.
*/
extern FILE *sudoersin;
extern char *errorfile;
extern int errorlineno;
extern bool parse_error;
/* /*
* Local prototypes. * Local prototypes.
*/ */

View File

@@ -100,9 +100,6 @@ struct sudo_user sudo_user;
struct passwd *list_pw; struct passwd *list_pw;
int long_list; int long_list;
uid_t timestamp_uid; uid_t timestamp_uid;
extern int errorlineno;
extern bool parse_error;
extern char *errorfile;
#ifdef HAVE_BSD_AUTH_H #ifdef HAVE_BSD_AUTH_H
char *login_style; char *login_style;
#endif /* HAVE_BSD_AUTH_H */ #endif /* HAVE_BSD_AUTH_H */

View File

@@ -269,13 +269,22 @@ int pam_prep_user(struct passwd *);
/* gram.y */ /* gram.y */
int sudoersparse(void); int sudoersparse(void);
extern char *login_style;
extern const char *errorfile;
extern int errorlineno;
extern bool parse_error;
extern bool sudoers_warnings;
/* toke.l */ /* toke.l */
YY_DECL; YY_DECL;
extern FILE *sudoersin;
extern const char *sudoers_file; extern const char *sudoers_file;
extern char *sudoers;
extern mode_t sudoers_mode; extern mode_t sudoers_mode;
extern uid_t sudoers_uid; extern uid_t sudoers_uid;
extern gid_t sudoers_gid; extern gid_t sudoers_gid;
extern int sudolineno;
extern int last_token;
/* defaults.c */ /* defaults.c */
void dump_defaults(void); void dump_defaults(void);

View File

@@ -102,13 +102,6 @@ extern int (*trace_print)(const char *msg);
struct sudo_user sudo_user; struct sudo_user sudo_user;
struct passwd *list_pw; struct passwd *list_pw;
static char *runas_group, *runas_user; static char *runas_group, *runas_user;
extern int errorlineno;
extern bool parse_error;
extern char *errorfile;
/* For getopt(3) */
extern char *optarg;
extern int optind;
#if defined(SUDO_DEVEL) && defined(__OpenBSD__) #if defined(SUDO_DEVEL) && defined(__OpenBSD__)
extern char *malloc_options; extern char *malloc_options;

View File

@@ -16,12 +16,12 @@
#define yyrestart sudoersrestart #define yyrestart sudoersrestart
#define yytext sudoerstext #define yytext sudoerstext
/* $OpenBSD: flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $ */ /* $OpenBSD: flex.skl,v 1.12 2013/11/04 17:03:32 millert Exp $ */
/* A lexical scanner generated by flex */ /* A lexical scanner generated by flex */
/* Scanner skeleton version: /* Scanner skeleton version:
* $Header: /home/cvs/openbsd/src/usr.bin/lex/flex.skl,v 1.11 2010/08/04 18:24:50 millert Exp $ * $Header: /cvs/src/usr.bin/lex/flex.skl,v 1.12 2013/11/04 17:03:32 millert Exp $
*/ */
#define FLEX_SCANNER #define FLEX_SCANNER
@@ -2007,12 +2007,9 @@ char *yytext;
#include "sha2.h" #include "sha2.h"
#include "secure_path.h" #include "secure_path.h"
extern YYSTYPE sudoerslval; int sudolineno; /* current sudoers line number. */
extern bool parse_error; int last_token; /* last token that was parsed. */
extern bool sudoers_warnings; char *sudoers; /* sudoers file being parsed. */
int sudolineno;
int last_token;
char *sudoers;
/* Default sudoers path, mode and owner (may be set via sudo.conf) */ /* Default sudoers path, mode and owner (may be set via sudo.conf) */
const char *sudoers_file = _PATH_SUDOERS; const char *sudoers_file = _PATH_SUDOERS;
@@ -2053,7 +2050,7 @@ int (*trace_print)(const char *msg) = sudoers_trace_print;
#define WANTDIGEST 6 #define WANTDIGEST 6
#line 2056 "lex.sudoers.c" #line 2053 "lex.sudoers.c"
/* Macros after this point can all be overridden by user definitions in /* Macros after this point can all be overridden by user definitions in
* section 1. * section 1.
@@ -2207,9 +2204,9 @@ YY_DECL
register char *yy_cp, *yy_bp; register char *yy_cp, *yy_bp;
register int yy_act; register int yy_act;
#line 140 "toke.l" #line 137 "toke.l"
#line 2212 "lex.sudoers.c" #line 2209 "lex.sudoers.c"
if ( yy_init ) if ( yy_init )
{ {
@@ -2295,7 +2292,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 141 "toke.l" #line 138 "toke.l"
{ {
LEXTRACE(", "); LEXTRACE(", ");
LEXRETURN(','); LEXRETURN(',');
@@ -2303,12 +2300,12 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 146 "toke.l" #line 143 "toke.l"
BEGIN STARTDEFS; BEGIN STARTDEFS;
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 148 "toke.l" #line 145 "toke.l"
{ {
BEGIN INDEFS; BEGIN INDEFS;
LEXTRACE("DEFVAR "); LEXTRACE("DEFVAR ");
@@ -2320,7 +2317,7 @@ YY_RULE_SETUP
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 157 "toke.l" #line 154 "toke.l"
{ {
BEGIN STARTDEFS; BEGIN STARTDEFS;
LEXTRACE(", "); LEXTRACE(", ");
@@ -2329,7 +2326,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 163 "toke.l" #line 160 "toke.l"
{ {
LEXTRACE("= "); LEXTRACE("= ");
LEXRETURN('='); LEXRETURN('=');
@@ -2337,7 +2334,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 168 "toke.l" #line 165 "toke.l"
{ {
LEXTRACE("+= "); LEXTRACE("+= ");
LEXRETURN('+'); LEXRETURN('+');
@@ -2345,7 +2342,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 173 "toke.l" #line 170 "toke.l"
{ {
LEXTRACE("-= "); LEXTRACE("-= ");
LEXRETURN('-'); LEXRETURN('-');
@@ -2353,7 +2350,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 178 "toke.l" #line 175 "toke.l"
{ {
LEXTRACE("BEGINSTR "); LEXTRACE("BEGINSTR ");
sudoerslval.string = NULL; sudoerslval.string = NULL;
@@ -2363,7 +2360,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 185 "toke.l" #line 182 "toke.l"
{ {
LEXTRACE("WORD(2) "); LEXTRACE("WORD(2) ");
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
@@ -2375,7 +2372,7 @@ YY_RULE_SETUP
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 194 "toke.l" #line 191 "toke.l"
{ {
/* Line continuation char followed by newline. */ /* Line continuation char followed by newline. */
sudolineno++; sudolineno++;
@@ -2384,7 +2381,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 200 "toke.l" #line 197 "toke.l"
{ {
LEXTRACE("ENDSTR "); LEXTRACE("ENDSTR ");
BEGIN prev_state; BEGIN prev_state;
@@ -2419,7 +2416,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 232 "toke.l" #line 229 "toke.l"
{ {
LEXTRACE("BACKSLASH "); LEXTRACE("BACKSLASH ");
if (!append(sudoerstext, sudoersleng)) if (!append(sudoerstext, sudoersleng))
@@ -2428,7 +2425,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 238 "toke.l" #line 235 "toke.l"
{ {
LEXTRACE("STRBODY "); LEXTRACE("STRBODY ");
if (!append(sudoerstext, sudoersleng)) if (!append(sudoerstext, sudoersleng))
@@ -2439,7 +2436,7 @@ YY_RULE_SETUP
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 246 "toke.l" #line 243 "toke.l"
{ {
/* quoted fnmatch glob char, pass verbatim */ /* quoted fnmatch glob char, pass verbatim */
LEXTRACE("QUOTEDCHAR "); LEXTRACE("QUOTEDCHAR ");
@@ -2450,7 +2447,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 254 "toke.l" #line 251 "toke.l"
{ {
/* quoted sudoers special char, strip backslash */ /* quoted sudoers special char, strip backslash */
LEXTRACE("QUOTEDCHAR "); LEXTRACE("QUOTEDCHAR ");
@@ -2461,7 +2458,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 262 "toke.l" #line 259 "toke.l"
{ {
BEGIN INITIAL; BEGIN INITIAL;
yyless(0); yyless(0);
@@ -2470,7 +2467,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 268 "toke.l" #line 265 "toke.l"
{ {
LEXTRACE("ARG "); LEXTRACE("ARG ");
if (!fill_args(sudoerstext, sudoersleng, sawspace)) if (!fill_args(sudoerstext, sudoersleng, sawspace))
@@ -2481,7 +2478,7 @@ YY_RULE_SETUP
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 276 "toke.l" #line 273 "toke.l"
{ {
/* Only return DIGEST if the length is correct. */ /* Only return DIGEST if the length is correct. */
if (sudoersleng == digest_len * 2) { if (sudoersleng == digest_len * 2) {
@@ -2497,7 +2494,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 289 "toke.l" #line 286 "toke.l"
{ {
/* Only return DIGEST if the length is correct. */ /* Only return DIGEST if the length is correct. */
int len; int len;
@@ -2521,7 +2518,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
#line 310 "toke.l" #line 307 "toke.l"
{ {
char *path; char *path;
@@ -2542,7 +2539,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 21: case 21:
YY_RULE_SETUP YY_RULE_SETUP
#line 328 "toke.l" #line 325 "toke.l"
{ {
char *path; char *path;
@@ -2566,7 +2563,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 22: case 22:
YY_RULE_SETUP YY_RULE_SETUP
#line 349 "toke.l" #line 346 "toke.l"
{ {
char deftype; char deftype;
int n; int n;
@@ -2609,7 +2606,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 23: case 23:
YY_RULE_SETUP YY_RULE_SETUP
#line 389 "toke.l" #line 386 "toke.l"
{ {
int n; int n;
@@ -2638,7 +2635,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 24: case 24:
YY_RULE_SETUP YY_RULE_SETUP
#line 415 "toke.l" #line 412 "toke.l"
{ {
/* cmnd does not require passwd for this user */ /* cmnd does not require passwd for this user */
LEXTRACE("NOPASSWD "); LEXTRACE("NOPASSWD ");
@@ -2647,7 +2644,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 25: case 25:
YY_RULE_SETUP YY_RULE_SETUP
#line 421 "toke.l" #line 418 "toke.l"
{ {
/* cmnd requires passwd for this user */ /* cmnd requires passwd for this user */
LEXTRACE("PASSWD "); LEXTRACE("PASSWD ");
@@ -2656,7 +2653,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 26: case 26:
YY_RULE_SETUP YY_RULE_SETUP
#line 427 "toke.l" #line 424 "toke.l"
{ {
LEXTRACE("NOEXEC "); LEXTRACE("NOEXEC ");
LEXRETURN(NOEXEC); LEXRETURN(NOEXEC);
@@ -2664,7 +2661,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 27: case 27:
YY_RULE_SETUP YY_RULE_SETUP
#line 432 "toke.l" #line 429 "toke.l"
{ {
LEXTRACE("EXEC "); LEXTRACE("EXEC ");
LEXRETURN(EXEC); LEXRETURN(EXEC);
@@ -2672,7 +2669,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 28: case 28:
YY_RULE_SETUP YY_RULE_SETUP
#line 437 "toke.l" #line 434 "toke.l"
{ {
LEXTRACE("SETENV "); LEXTRACE("SETENV ");
LEXRETURN(SETENV); LEXRETURN(SETENV);
@@ -2680,7 +2677,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 29: case 29:
YY_RULE_SETUP YY_RULE_SETUP
#line 442 "toke.l" #line 439 "toke.l"
{ {
LEXTRACE("NOSETENV "); LEXTRACE("NOSETENV ");
LEXRETURN(NOSETENV); LEXRETURN(NOSETENV);
@@ -2688,7 +2685,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 30: case 30:
YY_RULE_SETUP YY_RULE_SETUP
#line 447 "toke.l" #line 444 "toke.l"
{ {
LEXTRACE("LOG_OUTPUT "); LEXTRACE("LOG_OUTPUT ");
LEXRETURN(LOG_OUTPUT); LEXRETURN(LOG_OUTPUT);
@@ -2696,7 +2693,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 31: case 31:
YY_RULE_SETUP YY_RULE_SETUP
#line 452 "toke.l" #line 449 "toke.l"
{ {
LEXTRACE("NOLOG_OUTPUT "); LEXTRACE("NOLOG_OUTPUT ");
LEXRETURN(NOLOG_OUTPUT); LEXRETURN(NOLOG_OUTPUT);
@@ -2704,7 +2701,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 32: case 32:
YY_RULE_SETUP YY_RULE_SETUP
#line 457 "toke.l" #line 454 "toke.l"
{ {
LEXTRACE("LOG_INPUT "); LEXTRACE("LOG_INPUT ");
LEXRETURN(LOG_INPUT); LEXRETURN(LOG_INPUT);
@@ -2712,7 +2709,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 33: case 33:
YY_RULE_SETUP YY_RULE_SETUP
#line 462 "toke.l" #line 459 "toke.l"
{ {
LEXTRACE("NOLOG_INPUT "); LEXTRACE("NOLOG_INPUT ");
LEXRETURN(NOLOG_INPUT); LEXRETURN(NOLOG_INPUT);
@@ -2720,7 +2717,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 34: case 34:
YY_RULE_SETUP YY_RULE_SETUP
#line 467 "toke.l" #line 464 "toke.l"
{ {
/* empty group or netgroup */ /* empty group or netgroup */
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
@@ -2729,7 +2726,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 35: case 35:
YY_RULE_SETUP YY_RULE_SETUP
#line 473 "toke.l" #line 470 "toke.l"
{ {
/* netgroup */ /* netgroup */
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
@@ -2740,7 +2737,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 36: case 36:
YY_RULE_SETUP YY_RULE_SETUP
#line 481 "toke.l" #line 478 "toke.l"
{ {
/* group */ /* group */
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
@@ -2751,7 +2748,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 37: case 37:
YY_RULE_SETUP YY_RULE_SETUP
#line 489 "toke.l" #line 486 "toke.l"
{ {
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
yyterminate(); yyterminate();
@@ -2761,7 +2758,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 38: case 38:
YY_RULE_SETUP YY_RULE_SETUP
#line 496 "toke.l" #line 493 "toke.l"
{ {
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
yyterminate(); yyterminate();
@@ -2771,7 +2768,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 39: case 39:
YY_RULE_SETUP YY_RULE_SETUP
#line 503 "toke.l" #line 500 "toke.l"
{ {
if (!ipv6_valid(sudoerstext)) { if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
@@ -2785,7 +2782,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 40: case 40:
YY_RULE_SETUP YY_RULE_SETUP
#line 514 "toke.l" #line 511 "toke.l"
{ {
if (!ipv6_valid(sudoerstext)) { if (!ipv6_valid(sudoerstext)) {
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
@@ -2799,7 +2796,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 41: case 41:
YY_RULE_SETUP YY_RULE_SETUP
#line 525 "toke.l" #line 522 "toke.l"
{ {
LEXTRACE("ALL "); LEXTRACE("ALL ");
LEXRETURN(ALL); LEXRETURN(ALL);
@@ -2808,7 +2805,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 42: case 42:
YY_RULE_SETUP YY_RULE_SETUP
#line 531 "toke.l" #line 528 "toke.l"
{ {
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
LEXTRACE("ROLE "); LEXTRACE("ROLE ");
@@ -2820,7 +2817,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 43: case 43:
YY_RULE_SETUP YY_RULE_SETUP
#line 540 "toke.l" #line 537 "toke.l"
{ {
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
LEXTRACE("TYPE "); LEXTRACE("TYPE ");
@@ -2832,7 +2829,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 44: case 44:
YY_RULE_SETUP YY_RULE_SETUP
#line 548 "toke.l" #line 545 "toke.l"
{ {
#ifdef HAVE_PRIV_SET #ifdef HAVE_PRIV_SET
LEXTRACE("PRIVS "); LEXTRACE("PRIVS ");
@@ -2844,7 +2841,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 45: case 45:
YY_RULE_SETUP YY_RULE_SETUP
#line 557 "toke.l" #line 554 "toke.l"
{ {
#ifdef HAVE_PRIV_SET #ifdef HAVE_PRIV_SET
LEXTRACE("LIMITPRIVS "); LEXTRACE("LIMITPRIVS ");
@@ -2856,7 +2853,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 46: case 46:
YY_RULE_SETUP YY_RULE_SETUP
#line 566 "toke.l" #line 563 "toke.l"
{ {
got_alias: got_alias:
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
@@ -2867,7 +2864,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 47: case 47:
YY_RULE_SETUP YY_RULE_SETUP
#line 574 "toke.l" #line 571 "toke.l"
{ {
/* XXX - no way to specify digest for command */ /* XXX - no way to specify digest for command */
/* no command args allowed for Defaults!/path */ /* no command args allowed for Defaults!/path */
@@ -2879,7 +2876,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 48: case 48:
YY_RULE_SETUP YY_RULE_SETUP
#line 583 "toke.l" #line 580 "toke.l"
{ {
digest_len = SHA224_DIGEST_LENGTH; digest_len = SHA224_DIGEST_LENGTH;
BEGIN WANTDIGEST; BEGIN WANTDIGEST;
@@ -2889,7 +2886,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 49: case 49:
YY_RULE_SETUP YY_RULE_SETUP
#line 590 "toke.l" #line 587 "toke.l"
{ {
digest_len = SHA256_DIGEST_LENGTH; digest_len = SHA256_DIGEST_LENGTH;
BEGIN WANTDIGEST; BEGIN WANTDIGEST;
@@ -2899,7 +2896,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 50: case 50:
YY_RULE_SETUP YY_RULE_SETUP
#line 597 "toke.l" #line 594 "toke.l"
{ {
digest_len = SHA384_DIGEST_LENGTH; digest_len = SHA384_DIGEST_LENGTH;
BEGIN WANTDIGEST; BEGIN WANTDIGEST;
@@ -2909,7 +2906,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 51: case 51:
YY_RULE_SETUP YY_RULE_SETUP
#line 604 "toke.l" #line 601 "toke.l"
{ {
digest_len = SHA512_DIGEST_LENGTH; digest_len = SHA512_DIGEST_LENGTH;
BEGIN WANTDIGEST; BEGIN WANTDIGEST;
@@ -2919,7 +2916,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 52: case 52:
YY_RULE_SETUP YY_RULE_SETUP
#line 611 "toke.l" #line 608 "toke.l"
{ {
BEGIN GOTCMND; BEGIN GOTCMND;
LEXTRACE("COMMAND "); LEXTRACE("COMMAND ");
@@ -2929,7 +2926,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 53: case 53:
YY_RULE_SETUP YY_RULE_SETUP
#line 618 "toke.l" #line 615 "toke.l"
{ {
/* directories can't have args... */ /* directories can't have args... */
if (sudoerstext[sudoersleng - 1] == '/') { if (sudoerstext[sudoersleng - 1] == '/') {
@@ -2947,7 +2944,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 54: case 54:
YY_RULE_SETUP YY_RULE_SETUP
#line 633 "toke.l" #line 630 "toke.l"
{ {
LEXTRACE("BEGINSTR "); LEXTRACE("BEGINSTR ");
sudoerslval.string = NULL; sudoerslval.string = NULL;
@@ -2957,7 +2954,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 55: case 55:
YY_RULE_SETUP YY_RULE_SETUP
#line 640 "toke.l" #line 637 "toke.l"
{ {
/* a word */ /* a word */
if (!fill(sudoerstext, sudoersleng)) if (!fill(sudoerstext, sudoersleng))
@@ -2968,7 +2965,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 56: case 56:
YY_RULE_SETUP YY_RULE_SETUP
#line 648 "toke.l" #line 645 "toke.l"
{ {
LEXTRACE("( "); LEXTRACE("( ");
LEXRETURN('('); LEXRETURN('(');
@@ -2976,7 +2973,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 57: case 57:
YY_RULE_SETUP YY_RULE_SETUP
#line 653 "toke.l" #line 650 "toke.l"
{ {
LEXTRACE(") "); LEXTRACE(") ");
LEXRETURN(')'); LEXRETURN(')');
@@ -2984,7 +2981,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 58: case 58:
YY_RULE_SETUP YY_RULE_SETUP
#line 658 "toke.l" #line 655 "toke.l"
{ {
LEXTRACE(", "); LEXTRACE(", ");
LEXRETURN(','); LEXRETURN(',');
@@ -2992,7 +2989,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 59: case 59:
YY_RULE_SETUP YY_RULE_SETUP
#line 663 "toke.l" #line 660 "toke.l"
{ {
LEXTRACE("= "); LEXTRACE("= ");
LEXRETURN('='); LEXRETURN('=');
@@ -3000,7 +2997,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 60: case 60:
YY_RULE_SETUP YY_RULE_SETUP
#line 668 "toke.l" #line 665 "toke.l"
{ {
LEXTRACE(": "); LEXTRACE(": ");
LEXRETURN(':'); LEXRETURN(':');
@@ -3008,7 +3005,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 61: case 61:
YY_RULE_SETUP YY_RULE_SETUP
#line 673 "toke.l" #line 670 "toke.l"
{ {
if (sudoersleng & 1) { if (sudoersleng & 1) {
LEXTRACE("!"); LEXTRACE("!");
@@ -3018,7 +3015,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 62: case 62:
YY_RULE_SETUP YY_RULE_SETUP
#line 680 "toke.l" #line 677 "toke.l"
{ {
if (YY_START == INSTR) { if (YY_START == INSTR) {
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
@@ -3033,14 +3030,14 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 63: case 63:
YY_RULE_SETUP YY_RULE_SETUP
#line 692 "toke.l" #line 689 "toke.l"
{ /* throw away space/tabs */ { /* throw away space/tabs */
sawspace = true; /* but remember for fill_args */ sawspace = true; /* but remember for fill_args */
} }
YY_BREAK YY_BREAK
case 64: case 64:
YY_RULE_SETUP YY_RULE_SETUP
#line 696 "toke.l" #line 693 "toke.l"
{ {
sawspace = true; /* remember for fill_args */ sawspace = true; /* remember for fill_args */
sudolineno++; sudolineno++;
@@ -3049,7 +3046,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 65: case 65:
YY_RULE_SETUP YY_RULE_SETUP
#line 702 "toke.l" #line 699 "toke.l"
{ {
if (sudoerstext[sudoersleng - 1] == '\n') { if (sudoerstext[sudoersleng - 1] == '\n') {
/* comment ending in a newline */ /* comment ending in a newline */
@@ -3066,7 +3063,7 @@ YY_RULE_SETUP
YY_BREAK YY_BREAK
case 66: case 66:
YY_RULE_SETUP YY_RULE_SETUP
#line 716 "toke.l" #line 713 "toke.l"
{ {
LEXTRACE("ERROR "); LEXTRACE("ERROR ");
LEXRETURN(ERROR); LEXRETURN(ERROR);
@@ -3079,7 +3076,7 @@ case YY_STATE_EOF(STARTDEFS):
case YY_STATE_EOF(INDEFS): case YY_STATE_EOF(INDEFS):
case YY_STATE_EOF(INSTR): case YY_STATE_EOF(INSTR):
case YY_STATE_EOF(WANTDIGEST): case YY_STATE_EOF(WANTDIGEST):
#line 721 "toke.l" #line 718 "toke.l"
{ {
if (YY_START != INITIAL) { if (YY_START != INITIAL) {
BEGIN INITIAL; BEGIN INITIAL;
@@ -3092,10 +3089,10 @@ case YY_STATE_EOF(WANTDIGEST):
YY_BREAK YY_BREAK
case 67: case 67:
YY_RULE_SETUP YY_RULE_SETUP
#line 731 "toke.l" #line 728 "toke.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 3098 "lex.sudoers.c" #line 3095 "lex.sudoers.c"
case YY_END_OF_BUFFER: case YY_END_OF_BUFFER:
{ {
@@ -3986,7 +3983,7 @@ int main()
return 0; return 0;
} }
#endif #endif
#line 731 "toke.l" #line 728 "toke.l"
struct path_list { struct path_list {
SLIST_ENTRY(path_list) entries; SLIST_ENTRY(path_list) entries;

View File

@@ -79,12 +79,9 @@
#include "sha2.h" #include "sha2.h"
#include "secure_path.h" #include "secure_path.h"
extern YYSTYPE sudoerslval; int sudolineno; /* current sudoers line number. */
extern bool parse_error; int last_token; /* last token that was parsed. */
extern bool sudoers_warnings; char *sudoers; /* sudoers file being parsed. */
int sudolineno;
int last_token;
char *sudoers;
/* Default sudoers path, mode and owner (may be set via sudo.conf) */ /* Default sudoers path, mode and owner (may be set via sudo.conf) */
const char *sudoers_file = _PATH_SUDOERS; const char *sudoers_file = _PATH_SUDOERS;

View File

@@ -114,20 +114,11 @@ static void help(void) __attribute__((__noreturn__));
static void usage(int); static void usage(int);
static void visudo_cleanup(void); static void visudo_cleanup(void);
extern bool export_sudoers(char *, bool, bool); extern bool export_sudoers(const char *, bool, bool);
extern void sudoerserror(const char *); extern void sudoerserror(const char *);
extern void sudoersrestart(FILE *); extern void sudoersrestart(FILE *);
/*
* External globals exported by the parser
*/
extern struct rbtree *aliases;
extern FILE *sudoersin;
extern char *sudoers, *errorfile;
extern int errorlineno;
extern bool parse_error;
/* /*
* Globals * Globals
*/ */

View File

@@ -43,14 +43,6 @@
#include "gettext.h" #include "gettext.h"
#include <gram.h> #include <gram.h>
/*
* External globals exported by the parser
*/
extern FILE *sudoersin;
extern char *sudoers, *errorfile;
extern int errorlineno;
extern bool parse_error;
/* /*
* JSON values may be of the following types. * JSON values may be of the following types.
*/ */

View File

@@ -41,6 +41,7 @@
#include "missing.h" #include "missing.h"
#include "alloc.h" #include "alloc.h"
#include "fatal.h" #include "fatal.h"
#include "sudo_util.h"
__dso_public int main(int argc, char *argv[]); __dso_public int main(int argc, char *argv[]);