#define YYPREFIX "yy"
#line 2 "gram.y"
/*
- * Copyright (c) 1996, 1998-2005, 2007-2011
+ * Copyright (c) 1996, 1998-2005, 2007-2012
* Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
extern int sudolineno;
extern int last_token;
extern char *sudoers;
-static bool verbose = false;
+bool sudoers_warnings = true;
bool parse_error = false;
int errorlineno = -1;
char *errorfile = NULL;
}
if (trace_print != NULL) {
LEXTRACE("<*> ");
- } else if (verbose && s != NULL) {
+ } else if (sudoers_warnings && s != NULL) {
warningx(_(">>> %s: %s near line %d <<<"), sudoers, s, sudolineno);
}
parse_error = true;
struct defaults *d;
debug_decl(new_default, SUDO_DEBUG_PARSER)
- d = emalloc(sizeof(struct defaults));
+ d = ecalloc(1, sizeof(struct defaults));
d->var = var;
d->val = val;
tq_init(&d->binding);
- d->type = 0;
+ /* d->type = 0; */
d->op = op;
d->prev = d;
- d->next = NULL;
+ /* d->next = NULL; */
debug_return_ptr(d);
}
struct member *m;
debug_decl(new_member, SUDO_DEBUG_PARSER)
- m = emalloc(sizeof(struct member));
+ m = ecalloc(1, sizeof(struct member));
m->name = name;
m->type = type;
m->prev = m;
- m->next = NULL;
+ /* m->next = NULL; */
debug_return_ptr(m);
}
struct userspec *u;
debug_decl(add_userspec, SUDO_DEBUG_PARSER)
- u = emalloc(sizeof(*u));
+ u = ecalloc(1, sizeof(*u));
list2tq(&u->users, members);
list2tq(&u->privileges, privs);
u->prev = u;
- u->next = NULL;
+ /* u->next = NULL; */
tq_append(&userspecs, u);
debug_return;
parse_error = false;
errorlineno = -1;
errorfile = sudoers;
- verbose = !quiet;
+ sudoers_warnings = !quiet;
debug_return;
}
#else
#define YY_SIZE_MAX 0x7fffffff
#endif
- if (newsize && YY_SIZE_MAX / newsize < sizeof *newss)
+ if (!newsize || YY_SIZE_MAX / newsize < sizeof *newss)
goto bail;
newss = yyss ? (short *)realloc(yyss, newsize * sizeof *newss) :
(short *)malloc(newsize * sizeof *newss); /* overflow check above */
goto bail;
yyss = newss;
yyssp = newss + i;
- if (newsize && YY_SIZE_MAX / newsize < sizeof *newvs)
+ if (!newsize || YY_SIZE_MAX / newsize < sizeof *newvs)
goto bail;
newvs = yyvs ? (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs) :
(YYSTYPE *)malloc(newsize * sizeof *newvs); /* overflow check above */
case 26:
#line 269 "gram.y"
{
- struct privilege *p = emalloc(sizeof(*p));
+ struct privilege *p = ecalloc(1, sizeof(*p));
list2tq(&p->hostlist, yyvsp[-2].member);
list2tq(&p->cmndlist, yyvsp[0].cmndspec);
p->prev = p;
- p->next = NULL;
+ /* p->next = NULL; */
yyval.privilege = p;
}
break;
case 36:
#line 339 "gram.y"
{
- struct cmndspec *cs = emalloc(sizeof(*cs));
+ struct cmndspec *cs = ecalloc(1, sizeof(*cs));
if (yyvsp[-3].runas != NULL) {
list2tq(&cs->runasuserlist, yyvsp[-3].runas->runasusers);
list2tq(&cs->runasgrouplist, yyvsp[-3].runas->runasgroups);
case 48:
#line 415 "gram.y"
{
- yyval.runas = emalloc(sizeof(struct runascontainer));
+ yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = yyvsp[0].member;
- yyval.runas->runasgroups = NULL;
+ /* $$->runasgroups = NULL; */
}
break;
case 49:
#line 420 "gram.y"
{
- yyval.runas = emalloc(sizeof(struct runascontainer));
+ yyval.runas = ecalloc(1, sizeof(struct runascontainer));
yyval.runas->runasusers = yyvsp[-2].member;
yyval.runas->runasgroups = yyvsp[0].member;
}
case 50:
#line 425 "gram.y"
{
- yyval.runas = emalloc(sizeof(struct runascontainer));
- yyval.runas->runasusers = NULL;
+ yyval.runas = ecalloc(1, sizeof(struct runascontainer));
+ /* $$->runasusers = NULL; */
yyval.runas->runasgroups = yyvsp[0].member;
}
break;
case 64:
#line 474 "gram.y"
{
- struct sudo_command *c = emalloc(sizeof(*c));
+ struct sudo_command *c = ecalloc(1, sizeof(*c));
c->cmnd = yyvsp[0].command.cmnd;
c->args = yyvsp[0].command.args;
yyval.member = new_member((char *)c, COMMAND);