]> granicus.if.org Git - sudo/commitdiff
Increment alias_seqno before calls to alias_remove_recursive() to
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 25 May 2011 15:31:11 +0000 (11:31 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 25 May 2011 15:31:11 +0000 (11:31 -0400)
avoid false positives with the alias loop detection.  Fixes spurious
warnings about unused aliases when they are nested.

plugins/sudoers/visudo.c

index 522286d8e28ef7d52e557109804a60d71a765036..4d6e3f777109ed83259b74339dca037c3ab9f27d 100644 (file)
@@ -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++;
+               }
            }
        }
     }