From: Todd C. Miller Date: Wed, 25 May 2011 15:31:11 +0000 (-0400) Subject: Increment alias_seqno before calls to alias_remove_recursive() to X-Git-Tag: SUDO_1_8_2~116^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=682333ae2da8602ad2de993e9e8c8c3ced9bb338;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. --- diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 522286d8e..4d6e3f777 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -1034,28 +1034,35 @@ check_aliases(int strict, int 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++; + } } } } @@ -1078,9 +1085,11 @@ check_aliases(int strict, int 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++; + } } } }