]> granicus.if.org Git - sudo/commitdiff
Add callback support
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2004 23:03:02 +0000 (23:03 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2004 23:03:02 +0000 (23:03 +0000)
defaults.c
defaults.h

index 4737c35fc20910f143028478a2d50d33fa2ae5c6..38394a5b948f9817e61f7ca660f83f7ac400d2bb 100644 (file)
@@ -59,6 +59,7 @@
 # ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
+#include <pwd.h>
 #ifdef HAVE_ERR_H
 # include <err.h>
 #else
@@ -538,6 +539,8 @@ store_int(val, def, op)
        /* XXX - should check against INT_MAX */
        def->sd_un.ival = (unsigned int)l;
     }
+    if (def->callback)
+       return(def->callback(val));
     return(TRUE);
 }
 
@@ -559,6 +562,8 @@ store_uint(val, def, op)
        /* XXX - should check against INT_MAX */
        def->sd_un.ival = (unsigned int)l;
     }
+    if (def->callback)
+       return(def->callback(val));
     return(TRUE);
 }
 
@@ -589,6 +594,8 @@ store_tuple(val, def, op)
        if (v == NULL)
            return(FALSE);
     }
+    if (def->callback)
+       return(def->callback(val));
     return(TRUE);
 }
 
@@ -605,6 +612,8 @@ store_str(val, def, op)
        def->sd_un.str = NULL;
     else
        def->sd_un.str = estrdup(val);
+    if (def->callback)
+       return(def->callback(val));
     return(TRUE);
 }
 
@@ -729,6 +738,8 @@ store_mode(val, def, op)
            return(FALSE);
        def->sd_un.mode = (mode_t)l;
     }
+    if (def->callback)
+       return(def->callback(val));
     return(TRUE);
 }
 
index e39a8a105202863695633b7952aa15fda0db03ac..0c69e6977e87540cd41aa9b1fac65bd0d1c40114 100644 (file)
@@ -67,6 +67,7 @@ struct sudo_defs_types {
     int type;
     char *desc;
     struct def_values *values;
+    int (*callback) __P((char *));
     union {
        int flag;
        int ival;