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

--HG--
branch : 1.7

visudo.c

index bc77377f10e33a043f188714f8f289a578ca1413..b6d9d440c9140a5293f4b8d2d976e3d59da403a4 100644 (file)
--- 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++;
+               }
            }
        }
     }