]> granicus.if.org Git - sudo/commitdiff
fix check_aliases
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 18 Nov 2008 15:50:53 +0000 (15:50 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 18 Nov 2008 15:50:53 +0000 (15:50 +0000)
visudo.c

index c32cad841c826a1a45d0f11f84599a71b30b0cbc..e211d4565f0b4bdb9ff9946030d662b99c0c0b63 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -921,8 +921,9 @@ check_aliases(strict)
     /* Forward check. */
     tq_foreach_fwd(&userspecs, us) {
        tq_foreach_fwd(&us->users, m) {
-           if (m->type == USERALIAS) {
-               if (find_alias(m->name, m->type) == NULL) {
+           if (m->type == ALIAS) {
+               alias_seqno++;
+               if (find_alias(m->name, USERALIAS) == NULL) {
                    warningx("%s: User_Alias `%s' referenced but not defined",
                        strict ? "Error" : "Warning", m->name);
                    error++;
@@ -931,8 +932,9 @@ check_aliases(strict)
        }
        tq_foreach_fwd(&us->privileges, priv) {
            tq_foreach_fwd(&priv->hostlist, m) {
-               if (m->type == HOSTALIAS) {
-                   if (find_alias(m->name, m->type) == NULL) {
+               if (m->type == ALIAS) {
+                   alias_seqno++;
+                   if (find_alias(m->name, HOSTALIAS) == NULL) {
                        warningx("%s: Host_Alias `%s' referenced but not defined",
                            strict ? "Error" : "Warning", m->name);
                        error++;
@@ -941,16 +943,18 @@ check_aliases(strict)
            }
            tq_foreach_fwd(&priv->cmndlist, cs) {
                tq_foreach_fwd(&cs->runasuserlist, m) {
-                   if (m->type == RUNASALIAS) {
-                       if (find_alias(m->name, m->type) == NULL) {
+                   if (m->type == ALIAS) {
+                       alias_seqno++;
+                       if (find_alias(m->name, RUNASALIAS) == NULL) {
                            warningx("%s: Runas_Alias `%s' referenced but not defined",
                                strict ? "Error" : "Warning", m->name);
                            error++;
                        }
                    }
                }
-               if ((m = cs->cmnd)->type == CMNDALIAS) {
-                   if (find_alias(m->name, m->type) == NULL) {
+               if ((m = cs->cmnd)->type == ALIAS) {
+                   alias_seqno++;
+                   if (find_alias(m->name, CMNDALIAS) == NULL) {
                        warningx("%s: Cmnd_Alias `%s' referenced but not defined",
                            strict ? "Error" : "Warning", m->name);
                        error++;
@@ -963,21 +967,21 @@ check_aliases(strict)
     /* Reverse check (destructive) */
     tq_foreach_fwd(&userspecs, us) {
        tq_foreach_fwd(&us->users, m) {
-           if (m->type == USERALIAS)
-               (void) alias_remove(m->name, m->type);
+           if (m->type == ALIAS)
+               (void) alias_remove(m->name, USERALIAS);
        }
        tq_foreach_fwd(&us->privileges, priv) {
            tq_foreach_fwd(&priv->hostlist, m) {
-               if (m->type == HOSTALIAS)
-                   (void) alias_remove(m->name, m->type);
+               if (m->type == ALIAS)
+                   (void) alias_remove(m->name, HOSTALIAS);
            }
            tq_foreach_fwd(&priv->cmndlist, cs) {
                tq_foreach_fwd(&cs->runasuserlist, m) {
-                   if (m->type == RUNASALIAS)
-                       (void) alias_remove(m->name, m->type);
+                   if (m->type == ALIAS)
+                       (void) alias_remove(m->name, RUNASALIAS);
                }
-               if ((m = cs->cmnd)->type == CMNDALIAS)
-                   (void) alias_remove(m->name, m->type);
+               if ((m = cs->cmnd)->type == ALIAS)
+                   (void) alias_remove(m->name, CMNDALIAS);
            }
        }
     }