Change list head macros to take a pointer, not a struct.

This commit is contained in:
Todd C. Miller
2007-08-31 01:12:50 +00:00
parent 4df7037816
commit d1dbe2ecee
6 changed files with 97 additions and 97 deletions

View File

@@ -501,7 +501,7 @@ update_defaults(skip_cmnd)
{ {
struct defaults *def; struct defaults *def;
LH_FOREACH_FWD(defaults, def) { LH_FOREACH_FWD(&defaults, def) {
if (skip_cmnd == (def->type == DEFAULTS_CMND)) if (skip_cmnd == (def->type == DEFAULTS_CMND))
continue; continue;
switch (def->type) { switch (def->type) {

44
gram.y
View File

@@ -246,8 +246,8 @@ privilege : hostlist '=' cmndspeclist {
/* propagate tags and runas lists */ /* propagate tags and runas lists */
tags.nopasswd = tags.noexec = tags.setenv = UNSPEC; tags.nopasswd = tags.noexec = tags.setenv = UNSPEC;
for (cs = $3; cs != NULL; cs = cs->next) { for (cs = $3; cs != NULL; cs = cs->next) {
if (LH_EMPTY(cs->runaslist) && if (LH_EMPTY(&cs->runaslist) &&
!LH_EMPTY(cs->prev->runaslist)) { !LH_EMPTY(&cs->prev->runaslist)) {
memcpy(&cs->runaslist, &cs->prev->runaslist, memcpy(&cs->runaslist, &cs->prev->runaslist,
sizeof(cs->runaslist)); sizeof(cs->runaslist));
} }
@@ -559,24 +559,24 @@ init_parser(path, quiet)
struct privilege *priv; struct privilege *priv;
struct cmndspec *cs; struct cmndspec *cs;
while ((us = LH_LAST(userspecs)) != NULL) { while ((us = LH_LAST(&userspecs)) != NULL) {
LH_POP(userspecs); LH_POP(&userspecs);
while ((m = LH_LAST(us->users)) != NULL) { while ((m = LH_LAST(&us->users)) != NULL) {
LH_POP(us->users); LH_POP(&us->users);
efree(m->name); efree(m->name);
efree(m); efree(m);
} }
while ((priv = LH_LAST(us->privileges)) != NULL) { while ((priv = LH_LAST(&us->privileges)) != NULL) {
LH_POP(us->privileges); LH_POP(&us->privileges);
while ((m = LH_LAST(priv->hostlist)) != NULL) { while ((m = LH_LAST(&priv->hostlist)) != NULL) {
LH_POP(priv->hostlist); LH_POP(&priv->hostlist);
efree(m->name); efree(m->name);
efree(m); efree(m);
} }
while ((cs = LH_LAST(priv->cmndlist)) != NULL) { while ((cs = LH_LAST(&priv->cmndlist)) != NULL) {
LH_POP(priv->cmndlist); LH_POP(&priv->cmndlist);
while ((m = LH_LAST(cs->runaslist)) != NULL) { while ((m = LH_LAST(&cs->runaslist)) != NULL) {
LH_POP(cs->runaslist); LH_POP(&cs->runaslist);
efree(m->name); efree(m->name);
efree(m); efree(m);
} }
@@ -587,15 +587,15 @@ init_parser(path, quiet)
efree(priv); efree(priv);
} }
} }
LH_INIT(userspecs); LH_INIT(&userspecs);
lastbinding = NULL; lastbinding = NULL;
while ((d = LH_LAST(defaults)) != NULL) { while ((d = LH_LAST(&defaults)) != NULL) {
LH_POP(defaults); LH_POP(&defaults);
if (LH_FIRST(d->binding) != lastbinding) { if (LH_FIRST(&d->binding) != lastbinding) {
lastbinding = LH_FIRST(d->binding); lastbinding = LH_FIRST(&d->binding);
while ((m = LH_LAST(d->binding)) != NULL) { while ((m = LH_LAST(&d->binding)) != NULL) {
LH_POP(d->binding); LH_POP(&d->binding);
efree(m->name); efree(m->name);
efree(m); efree(m);
} }
@@ -604,7 +604,7 @@ init_parser(path, quiet)
efree(d->val); efree(d->val);
efree(d); efree(d);
} }
LH_INIT(defaults); LH_INIT(&defaults);
init_aliases(); init_aliases();

48
parse.c
View File

@@ -112,13 +112,13 @@ sudoers_lookup(pwflag)
match = DENY; match = DENY;
/* XXX - it should be faster to start from the bottom and /* XXX - it should be faster to start from the bottom and
work our way up and then just stop at the first match. */ work our way up and then just stop at the first match. */
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
if (userlist_matches(sudo_user.pw, &us->users) != ALLOW) if (userlist_matches(sudo_user.pw, &us->users) != ALLOW)
continue; continue;
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
if (hostlist_matches(&priv->hostlist) != ALLOW) if (hostlist_matches(&priv->hostlist) != ALLOW)
continue; continue;
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
/* Only check the command when listing another user. */ /* Only check the command when listing another user. */
if (user_uid == 0 || list_pw == NULL || if (user_uid == 0 || list_pw == NULL ||
user_uid == list_pw->pw_uid || user_uid == list_pw->pw_uid ||
@@ -148,19 +148,19 @@ sudoers_lookup(pwflag)
/* XXX - it should be faster to start from the bottom and /* XXX - it should be faster to start from the bottom and
work our way up and then just stop at the first match. */ work our way up and then just stop at the first match. */
match = UNSPEC; match = UNSPEC;
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
if (userlist_matches(sudo_user.pw, &us->users) != ALLOW) if (userlist_matches(sudo_user.pw, &us->users) != ALLOW)
continue; continue;
CLR(validated, FLAG_NO_USER); CLR(validated, FLAG_NO_USER);
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
host_match = hostlist_matches(&priv->hostlist); host_match = hostlist_matches(&priv->hostlist);
if (host_match == UNSPEC) if (host_match == UNSPEC)
continue; continue;
if (host_match == ALLOW) if (host_match == ALLOW)
CLR(validated, FLAG_NO_HOST); CLR(validated, FLAG_NO_HOST);
runas = NULL; runas = NULL;
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
if (!LH_EMPTY(cs->runaslist)) if (!LH_EMPTY(&cs->runaslist))
runas = &cs->runaslist; runas = &cs->runaslist;
runas_match = runaslist_matches(runas); runas_match = runaslist_matches(runas);
if (runas_match != UNSPEC) { if (runas_match != UNSPEC) {
@@ -227,24 +227,24 @@ display_privs(v, pw)
printf("User %s may run the following commands on this host:\n", printf("User %s may run the following commands on this host:\n",
pw->pw_name); pw->pw_name);
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
/* XXX - why only check the first privilege here? */ /* XXX - why only check the first privilege here? */
if (userlist_matches(pw, &us->users) != ALLOW || if (userlist_matches(pw, &us->users) != ALLOW ||
hostlist_matches(&us->privileges.first->hostlist) != ALLOW) hostlist_matches(&us->privileges.first->hostlist) != ALLOW)
continue; continue;
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
tags.noexec = def_noexec; tags.noexec = def_noexec;
tags.setenv = def_setenv; tags.setenv = def_setenv;
tags.nopasswd = !def_authenticate; tags.nopasswd = !def_authenticate;
lbuf_append(&lbuf, " ", NULL); lbuf_append(&lbuf, " ", NULL);
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
if (cs != LH_FIRST(priv->cmndlist)) if (cs != LH_FIRST(&priv->cmndlist))
lbuf_append(&lbuf, ", ", NULL); lbuf_append(&lbuf, ", ", NULL);
lbuf_append(&lbuf, "(", NULL); lbuf_append(&lbuf, "(", NULL);
if (!LH_EMPTY(cs->runaslist)) { if (!LH_EMPTY(&cs->runaslist)) {
LH_FOREACH_FWD(cs->runaslist, m) { LH_FOREACH_FWD(&cs->runaslist, m) {
if (m != LH_FIRST(cs->runaslist)) if (m != LH_FIRST(&cs->runaslist))
lbuf_append(&lbuf, ", ", NULL); lbuf_append(&lbuf, ", ", NULL);
print_member(&lbuf, m->name, m->type, m->negated, print_member(&lbuf, m->name, m->type, m->negated,
RUNASALIAS); RUNASALIAS);
@@ -297,7 +297,7 @@ display_defaults(pw)
lbuf_init(&lbuf, NULL, 4, 0); lbuf_init(&lbuf, NULL, 4, 0);
LH_FOREACH_FWD(defaults, d) { LH_FOREACH_FWD(&defaults, d) {
switch (d->type) { switch (d->type) {
case DEFAULTS_HOST: case DEFAULTS_HOST:
if (hostlist_matches(&d->binding) != ALLOW) if (hostlist_matches(&d->binding) != ALLOW)
@@ -384,12 +384,12 @@ display_bound_defaults(dtype)
} }
lbuf_init(&lbuf, NULL, 4, 0); lbuf_init(&lbuf, NULL, 4, 0);
printf("Per-%s Defaults entries:\n", dname); printf("Per-%s Defaults entries:\n", dname);
LH_FOREACH_FWD(defaults, d) { LH_FOREACH_FWD(&defaults, d) {
if (d->type != dtype) if (d->type != dtype)
continue; continue;
if (binding != LH_FIRST(d->binding)) { if (binding != LH_FIRST(&d->binding)) {
binding = LH_FIRST(d->binding); binding = LH_FIRST(&d->binding);
lbuf_append(&lbuf, " Defaults", dsep, NULL); lbuf_append(&lbuf, " Defaults", dsep, NULL);
for (m = binding; m != NULL; m = m->next) { for (m = binding; m != NULL; m = m->next) {
if (m != binding) if (m != binding)
@@ -433,17 +433,17 @@ display_cmnd(v, pw)
#endif #endif
if (rval != 0 && !def_ignore_local_sudoers) { if (rval != 0 && !def_ignore_local_sudoers) {
match = NULL; match = NULL;
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
if (userlist_matches(pw, &us->users) != ALLOW) if (userlist_matches(pw, &us->users) != ALLOW)
continue; continue;
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
host_match = hostlist_matches(&priv->hostlist); host_match = hostlist_matches(&priv->hostlist);
if (host_match == UNSPEC) if (host_match == UNSPEC)
continue; continue;
runas = NULL; runas = NULL;
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
if (!LH_EMPTY(cs->runaslist) != NULL) if (!LH_EMPTY(&cs->runaslist) != NULL)
runas = &cs->runaslist; runas = &cs->runaslist;
runas_match = runaslist_matches(runas); runas_match = runaslist_matches(runas);
if (runas_match != UNSPEC) { if (runas_match != UNSPEC) {
@@ -493,8 +493,8 @@ print_member(lbuf, name, type, negated, alias_type)
break; break;
case ALIAS: case ALIAS:
if ((a = find_alias(name, alias_type)) != NULL) { if ((a = find_alias(name, alias_type)) != NULL) {
LH_FOREACH_FWD(a->members, m) { LH_FOREACH_FWD(&a->members, m) {
if (m != LH_FIRST(a->members)) if (m != LH_FIRST(&a->members))
lbuf_append(lbuf, ", ", NULL); lbuf_append(lbuf, ", ", NULL);
print_member(lbuf, m->name, m->type, print_member(lbuf, m->name, m->type,
negated ? !m->negated : m->negated, alias_type); negated ? !m->negated : m->negated, alias_type);

22
parse.h
View File

@@ -218,11 +218,11 @@ struct defaults {
#undef LH_FOREACH_FWD #undef LH_FOREACH_FWD
#define LH_FOREACH_FWD(h, v) \ #define LH_FOREACH_FWD(h, v) \
for ((v) = (h).first; (v) != NULL; (v) = (v)->next) for ((v) = (h)->first; (v) != NULL; (v) = (v)->next)
#undef LH_FOREACH_REV #undef LH_FOREACH_REV
#define LH_FOREACH_REV(h, v) \ #define LH_FOREACH_REV(h, v) \
for ((v) = (h).last; (v) != NULL; (v) = (v)->prev) for ((v) = (h)->last; (v) != NULL; (v) = (v)->prev)
/* /*
* Pop the last element off the end of h. * Pop the last element off the end of h.
@@ -231,29 +231,29 @@ struct defaults {
#undef LH_POP #undef LH_POP
#define LH_POP(h) do { \ #define LH_POP(h) do { \
if (!LH_EMPTY(h)) { \ if (!LH_EMPTY(h)) { \
if ((h).first == (h).last) \ if ((h)->first == (h)->last) \
(h).first = (h).last = NULL; \ (h)->first = (h)->last = NULL; \
else { \ else { \
(h).last = (h).last->prev; \ (h)->last = (h)->last->prev; \
(h).last->next = NULL; \ (h)->last->next = NULL; \
} \ } \
} \ } \
} while (0) } while (0)
#undef LH_INIT #undef LH_INIT
#define LH_INIT(h) do { \ #define LH_INIT(h) do { \
(h).first = NULL; \ (h)->first = NULL; \
(h).last = NULL; \ (h)->last = NULL; \
} while (0) } while (0)
#undef LH_EMPTY #undef LH_EMPTY
#define LH_EMPTY(h) ((h).first == NULL) #define LH_EMPTY(h) ((h)->first == NULL)
#undef LH_FIRST #undef LH_FIRST
#define LH_FIRST(h) ((h).first) #define LH_FIRST(h) ((h)->first)
#undef LH_LAST #undef LH_LAST
#define LH_LAST(h) ((h).last) #define LH_LAST(h) ((h)->last)
#undef LIST_NEXT #undef LIST_NEXT
#define LIST_NEXT(e) ((e)->next) #define LIST_NEXT(e) ((e)->next)

View File

@@ -269,18 +269,18 @@ main(argc, argv)
/* This loop must match the one in sudoers_lookup() */ /* This loop must match the one in sudoers_lookup() */
printf("\nEntries for user %s:\n", user_name); printf("\nEntries for user %s:\n", user_name);
matched = UNSPEC; matched = UNSPEC;
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
if (userlist_matches(sudo_user.pw, &us->users) != TRUE) if (userlist_matches(sudo_user.pw, &us->users) != TRUE)
continue; continue;
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
putchar('\n'); putchar('\n');
print_privilege(priv); /* XXX */ print_privilege(priv); /* XXX */
putchar('\n'); putchar('\n');
if (hostlist_matches(&priv->hostlist) == TRUE) { if (hostlist_matches(&priv->hostlist) == TRUE) {
puts("\thost matched"); puts("\thost matched");
runas = NULL; runas = NULL;
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
if (!LH_EMPTY(cs->runaslist)) if (!LH_EMPTY(&cs->runaslist))
runas = &cs->runaslist; runas = &cs->runaslist;
if (runaslist_matches(runas) == TRUE) { if (runaslist_matches(runas) == TRUE) {
puts("\trunas matched"); puts("\trunas matched");
@@ -388,7 +388,7 @@ print_defaults()
struct defaults *d; struct defaults *d;
struct member *m; struct member *m;
LH_FOREACH_FWD(defaults, d) { LH_FOREACH_FWD(&defaults, d) {
(void) fputs("Defaults", stdout); (void) fputs("Defaults", stdout);
switch (d->type) { switch (d->type) {
case DEFAULTS_HOST: case DEFAULTS_HOST:
@@ -404,8 +404,8 @@ print_defaults()
putchar('!'); putchar('!');
break; break;
} }
LH_FOREACH_FWD(d->binding, m) { LH_FOREACH_FWD(&d->binding, m) {
if (m != LH_FIRST(d->binding)) if (m != LH_FIRST(&d->binding))
putchar(','); putchar(',');
print_member(m); print_member(m);
} }
@@ -439,8 +439,8 @@ print_alias(v1, v2)
(void) printf("Runas_Alias\t%s = ", a->name); (void) printf("Runas_Alias\t%s = ", a->name);
break; break;
} }
LH_FOREACH_FWD(a->members, m) { LH_FOREACH_FWD(&a->members, m) {
if (m != LH_FIRST(a->members)) if (m != LH_FIRST(&a->members))
fputs(", ", stdout); fputs(", ", stdout);
if (m->type == COMMAND) { if (m->type == COMMAND) {
c = (struct sudo_command *) m->name; c = (struct sudo_command *) m->name;
@@ -465,20 +465,20 @@ print_privilege(priv)
for (p = priv; p != NULL; p = p->next) { for (p = priv; p != NULL; p = p->next) {
if (p != priv) if (p != priv)
fputs(" : ", stdout); fputs(" : ", stdout);
LH_FOREACH_FWD(p->hostlist, m) { LH_FOREACH_FWD(&p->hostlist, m) {
if (m != LH_FIRST(p->hostlist)) if (m != LH_FIRST(&p->hostlist))
fputs(", ", stdout); fputs(", ", stdout);
print_member(m); print_member(m);
} }
fputs(" = ", stdout); fputs(" = ", stdout);
tags.nopasswd = tags.noexec = UNSPEC; tags.nopasswd = tags.noexec = UNSPEC;
LH_FOREACH_FWD(p->cmndlist, cs) { LH_FOREACH_FWD(&p->cmndlist, cs) {
if (cs != LH_FIRST(p->cmndlist)) if (cs != LH_FIRST(&p->cmndlist))
fputs(", ", stdout); fputs(", ", stdout);
if (!LH_EMPTY(cs->runaslist)) { if (!LH_EMPTY(&cs->runaslist)) {
fputs("(", stdout); fputs("(", stdout);
LH_FOREACH_FWD(cs->runaslist, m) { LH_FOREACH_FWD(&cs->runaslist, m) {
if (m != LH_FIRST(cs->runaslist)) if (m != LH_FIRST(&cs->runaslist))
fputs(", ", stdout); fputs(", ", stdout);
print_member(m); print_member(m);
} }
@@ -500,9 +500,9 @@ print_userspecs()
struct member *m; struct member *m;
struct userspec *us; struct userspec *us;
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
LH_FOREACH_FWD(us->users, m) { LH_FOREACH_FWD(&us->users, m) {
if (m != LH_FIRST(us->users)) if (m != LH_FIRST(&us->users))
fputs(", ", stdout); fputs(", ", stdout);
print_member(m); print_member(m);
} }

View File

@@ -212,8 +212,8 @@ main(argc, argv)
setup_signals(); setup_signals();
/* Edit the sudoers file(s) */ /* Edit the sudoers file(s) */
LH_FOREACH_FWD(sudoerslist, sp) { LH_FOREACH_FWD(&sudoerslist, sp) {
if (sp != LH_FIRST(sudoerslist)) { if (sp != LH_FIRST(&sudoerslist)) {
printf("press return to edit %s: ", sp->path); printf("press return to edit %s: ", sp->path);
while ((ch = getchar()) != EOF && ch != '\n') while ((ch = getchar()) != EOF && ch != '\n')
continue; continue;
@@ -225,7 +225,7 @@ main(argc, argv)
reparse_sudoers(editor, args, strict, quiet); reparse_sudoers(editor, args, strict, quiet);
/* Install the sudoers temp files. */ /* Install the sudoers temp files. */
LH_FOREACH_FWD(sudoerslist, sp) { LH_FOREACH_FWD(&sudoerslist, sp) {
if (!sp->modified) if (!sp->modified)
(void) unlink(sp->tpath); (void) unlink(sp->tpath);
else else
@@ -400,8 +400,8 @@ reparse_sudoers(editor, args, strict, quiet)
* Parse the edited sudoers files and do sanity checking * Parse the edited sudoers files and do sanity checking
*/ */
do { do {
sp = LH_FIRST(sudoerslist); sp = LH_FIRST(&sudoerslist);
last = LH_LAST(sudoerslist); last = LH_LAST(&sudoerslist);
fp = fopen(sp->tpath, "r+"); fp = fopen(sp->tpath, "r+");
if (fp == NULL) if (fp == NULL)
errorx(1, "can't re-open temporary file (%s), %s unchanged.", errorx(1, "can't re-open temporary file (%s), %s unchanged.",
@@ -437,7 +437,7 @@ reparse_sudoers(editor, args, strict, quiet)
} }
if (parse_error) { if (parse_error) {
/* Edit file with the parse error */ /* Edit file with the parse error */
LH_FOREACH_FWD(sudoerslist, sp) { LH_FOREACH_FWD(&sudoerslist, sp) {
if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) { if (errorfile == NULL || strcmp(sp->path, errorfile) == 0) {
edit_sudoers(sp, editor, args, errorlineno); edit_sudoers(sp, editor, args, errorlineno);
break; break;
@@ -708,7 +708,7 @@ open_sudoers(path, keepopen)
FILE *fp; FILE *fp;
/* Check for existing entry */ /* Check for existing entry */
LH_FOREACH_FWD(sudoerslist, entry) { LH_FOREACH_FWD(&sudoerslist, entry) {
if (strcmp(path, entry->path) == 0) if (strcmp(path, entry->path) == 0)
break; break;
} }
@@ -886,8 +886,8 @@ check_aliases(strict)
int error = 0; int error = 0;
/* Forward check. */ /* Forward check. */
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
LH_FOREACH_FWD(us->users, m) { LH_FOREACH_FWD(&us->users, m) {
if (m->type == USERALIAS) { if (m->type == USERALIAS) {
if (find_alias(m->name, m->type) == NULL) { if (find_alias(m->name, m->type) == NULL) {
fprintf(stderr, fprintf(stderr,
@@ -897,8 +897,8 @@ check_aliases(strict)
} }
} }
} }
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
LH_FOREACH_FWD(priv->hostlist, m) { LH_FOREACH_FWD(&priv->hostlist, m) {
if (m->type == HOSTALIAS) { if (m->type == HOSTALIAS) {
if (find_alias(m->name, m->type) == NULL) { if (find_alias(m->name, m->type) == NULL) {
fprintf(stderr, fprintf(stderr,
@@ -908,8 +908,8 @@ check_aliases(strict)
} }
} }
} }
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
LH_FOREACH_FWD(cs->runaslist, m) { LH_FOREACH_FWD(&cs->runaslist, m) {
if (m->type == RUNASALIAS) { if (m->type == RUNASALIAS) {
if (find_alias(m->name, m->type) == NULL) { if (find_alias(m->name, m->type) == NULL) {
fprintf(stderr, fprintf(stderr,
@@ -932,18 +932,18 @@ check_aliases(strict)
} }
/* Reverse check (destructive) */ /* Reverse check (destructive) */
LH_FOREACH_FWD(userspecs, us) { LH_FOREACH_FWD(&userspecs, us) {
LH_FOREACH_FWD(us->users, m) { LH_FOREACH_FWD(&us->users, m) {
if (m->type == USERALIAS) if (m->type == USERALIAS)
(void) alias_remove(m->name, m->type); (void) alias_remove(m->name, m->type);
} }
LH_FOREACH_FWD(us->privileges, priv) { LH_FOREACH_FWD(&us->privileges, priv) {
LH_FOREACH_FWD(priv->hostlist, m) { LH_FOREACH_FWD(&priv->hostlist, m) {
if (m->type == HOSTALIAS) if (m->type == HOSTALIAS)
(void) alias_remove(m->name, m->type); (void) alias_remove(m->name, m->type);
} }
LH_FOREACH_FWD(priv->cmndlist, cs) { LH_FOREACH_FWD(&priv->cmndlist, cs) {
LH_FOREACH_FWD(cs->runaslist, m) { LH_FOREACH_FWD(&cs->runaslist, m) {
if (m->type == RUNASALIAS) if (m->type == RUNASALIAS)
(void) alias_remove(m->name, m->type); (void) alias_remove(m->name, m->type);
} }
@@ -983,7 +983,7 @@ cleanup(gotsignal)
{ {
struct sudoersfile *sp; struct sudoersfile *sp;
LH_FOREACH_FWD(sudoerslist, sp) { LH_FOREACH_FWD(&sudoerslist, sp) {
if (sp->tpath != NULL) if (sp->tpath != NULL)
(void) unlink(sp->tpath); (void) unlink(sp->tpath);
} }