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"));
|
sudoerserror(N_("a digest requires a path name"));
|
||||||
YYERROR;
|
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);
|
parser_leak_remove(LEAK_DIGEST, $1);
|
||||||
HLTQ_TO_TAILQ(&c->digests, $1, entries);
|
HLTQ_TO_TAILQ(&c->digests, $1, entries);
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
@@ -919,7 +911,13 @@ cmndtag : /* empty */ {
|
|||||||
;
|
;
|
||||||
|
|
||||||
cmnd : ALL {
|
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) {
|
if ($$ == NULL) {
|
||||||
sudoerserror(N_("unable to allocate memory"));
|
sudoerserror(N_("unable to allocate memory"));
|
||||||
YYERROR;
|
YYERROR;
|
||||||
|
@@ -396,11 +396,6 @@ cmnd_matches(struct sudoers_parse_tree *parse_tree, const struct member *m,
|
|||||||
|
|
||||||
switch (m->type) {
|
switch (m->type) {
|
||||||
case ALL:
|
case ALL:
|
||||||
if (m->name == NULL) {
|
|
||||||
matched = !m->negated;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
FALLTHROUGH;
|
|
||||||
case COMMAND:
|
case COMMAND:
|
||||||
c = (struct sudo_command *)m->name;
|
c = (struct sudo_command *)m->name;
|
||||||
if (command_matches(c->cmnd, c->args, runchroot, info, &c->digests))
|
if (command_matches(c->cmnd, c->args, runchroot, info, &c->digests))
|
||||||
|
Reference in New Issue
Block a user