Always allocate a struct sudo_command for the command, even for ALL.
Previously we special-cased handling of ALL but this complicates some upcoming changes.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -617,14 +617,6 @@ digcmnd : opcmnd {
|
||||
sudoerserror(N_("a digest requires a path name"));
|
||||
YYERROR;
|
||||
}
|
||||
if (c == NULL) {
|
||||
/* lazy-allocate sudo_command for ALL */
|
||||
if ((c = new_command(NULL, NULL)) == NULL) {
|
||||
sudoerserror(N_("unable to allocate memory"));
|
||||
YYERROR;
|
||||
}
|
||||
$2->name = (char *)c;
|
||||
}
|
||||
parser_leak_remove(LEAK_DIGEST, $1);
|
||||
HLTQ_TO_TAILQ(&c->digests, $1, entries);
|
||||
$$ = $2;
|
||||
@@ -919,7 +911,13 @@ cmndtag : /* empty */ {
|
||||
;
|
||||
|
||||
cmnd : ALL {
|
||||
$$ = new_member(NULL, ALL);
|
||||
struct sudo_command *c;
|
||||
|
||||
if ((c = new_command(NULL, NULL)) == NULL) {
|
||||
sudoerserror(N_("unable to allocate memory"));
|
||||
YYERROR;
|
||||
}
|
||||
$$ = new_member((char *)c, ALL);
|
||||
if ($$ == NULL) {
|
||||
sudoerserror(N_("unable to allocate memory"));
|
||||
YYERROR;
|
||||
|
@@ -396,11 +396,6 @@ cmnd_matches(struct sudoers_parse_tree *parse_tree, const struct member *m,
|
||||
|
||||
switch (m->type) {
|
||||
case ALL:
|
||||
if (m->name == NULL) {
|
||||
matched = !m->negated;
|
||||
break;
|
||||
}
|
||||
FALLTHROUGH;
|
||||
case COMMAND:
|
||||
c = (struct sudo_command *)m->name;
|
||||
if (command_matches(c->cmnd, c->args, runchroot, info, &c->digests))
|
||||
|
Reference in New Issue
Block a user