From: Todd C. Miller Date: Sat, 13 Aug 2011 18:39:32 +0000 (-0400) Subject: Increment alias_seqno before calls to alias_remove_recursive() to X-Git-Tag: SUDO_1_7_7~17 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=edd18c5a245947dc689e9af506f5a992dc1c7fc2;p=sudo Increment alias_seqno before calls to alias_remove_recursive() to avoid false positives with the alias loop detection. Fixes spurious warnings about unused aliases when they are nested. --HG-- branch : 1.7 --- diff --git a/visudo.c b/visudo.c index bc77377f1..b6d9d440c 100644 --- a/visudo.c +++ b/visudo.c @@ -1048,28 +1048,35 @@ check_aliases(strict, quiet) tq_foreach_fwd(&userspecs, us) { tq_foreach_fwd(&us->users, m) { if (m->type == ALIAS) { + alias_seqno++; if (!alias_remove_recursive(m->name, USERALIAS, strict, quiet)) error++; } } tq_foreach_fwd(&us->privileges, priv) { tq_foreach_fwd(&priv->hostlist, m) { - if (m->type == ALIAS) + if (m->type == ALIAS) { + alias_seqno++; if (!alias_remove_recursive(m->name, HOSTALIAS, strict, quiet)) error++; + } } tq_foreach_fwd(&priv->cmndlist, cs) { tq_foreach_fwd(&cs->runasuserlist, m) { - if (m->type == ALIAS) + if (m->type == ALIAS) { + alias_seqno++; if (!alias_remove_recursive(m->name, RUNASALIAS, strict, quiet)) error++; + } } - if ((m = cs->cmnd)->type == ALIAS) + if ((m = cs->cmnd)->type == ALIAS) { + alias_seqno++; if (!alias_remove_recursive(m->name, CMNDALIAS, strict, quiet)) error++; + } } } } @@ -1092,9 +1099,11 @@ check_aliases(strict, quiet) } tq_foreach_fwd(&d->binding, binding) { for (m = binding; m != NULL; m = m->next) { - if (m->type == ALIAS) + if (m->type == ALIAS) { + alias_seqno++; if (!alias_remove_recursive(m->name, atype, strict, quiet)) error++; + } } } }