]> granicus.if.org Git - sudo/commitdiff
When checking for alias use, also check defaults bindings.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 22 Nov 2008 15:12:26 +0000 (15:12 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 22 Nov 2008 15:12:26 +0000 (15:12 +0000)
visudo.c

index cd468c1688cc82bfce8189ea01a4cece38fbaeee..235179f1643143495c1b95c37672708fb961e809 100644 (file)
--- a/visudo.c
+++ b/visudo.c
@@ -917,10 +917,11 @@ check_aliases(strict)
     int strict;
 {
     struct cmndspec *cs;
-    struct member *m;
+    struct member *m, *binding;
     struct privilege *priv;
     struct userspec *us;
-    int error = 0;
+    struct defaults *d;
+    int atype, error = 0;
 
     /* Forward check. */
     tq_foreach_fwd(&userspecs, us) {
@@ -989,6 +990,31 @@ check_aliases(strict)
            }
        }
     }
+    tq_foreach_fwd(&defaults, d) {
+       switch (d->type) {
+           case DEFAULTS_HOST:
+               atype = HOSTALIAS;
+               break;
+           case DEFAULTS_USER:
+               atype = USERALIAS;
+               break;
+           case DEFAULTS_RUNAS:
+               atype = RUNASALIAS;
+               break;
+           case DEFAULTS_CMND:
+               atype = CMNDALIAS;
+               break;
+           default:
+               continue; /* not an alias */
+       }
+       tq_foreach_fwd(&d->binding, binding) {
+           for (m = binding; m != NULL; m = m->next) {
+               if (m->type == ALIAS)
+                   (void) alias_remove(m->name, atype);
+           }
+       }
+    }
+
     /* If all aliases were referenced we will have an empty tree. */
     if (no_aliases())
        return(0);