]> granicus.if.org Git - sudo/commitdiff
Use sudo_hook_fn_t in struct sudo_hook.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Mar 2012 21:32:50 +0000 (17:32 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 13 Mar 2012 21:32:50 +0000 (17:32 -0400)
include/sudo_plugin.h

index 4269b7158f1ae97c42e235edb9b803136092b4bd..36d23d2988b0759bbc3d4396ab098fade43331eb 100644 (file)
@@ -56,13 +56,21 @@ typedef int (*sudo_conv_t)(int num_msgs, const struct sudo_conv_message msgs[],
 typedef int (*sudo_printf_t)(int msg_type, const char *fmt, ...);
 
 /*
- * Hook structure for the optional plugin hook list.
- * This allows the plugin to hook into specific sudo and/or libc functions.
+ * Hooks allow a plugin to hook into specific sudo and/or libc functions.
  */
+
+/* Hook functions typedefs. */
+typedef int (*sudo_hook_fn_t)();
+typedef int (*sudo_hook_fn_setenv_t)(const char *name, const char *value, int overwrite, void *closure);
+typedef int (*sudo_hook_fn_putenv_t)(char *string, void *closure);
+typedef int (*sudo_hook_fn_getenv_t)(const char *name, char **value, void *closure);
+typedef int (*sudo_hook_fn_unsetenv_t)(const char *name, void *closure);
+
+/* Hook structure definition. */
 struct sudo_hook {
     int hook_version;
     int hook_type;
-    int (*hook_fn)();
+    sudo_hook_fn_t hook_fn;
     void *closure;
 };
 
@@ -87,7 +95,7 @@ struct sudo_hook {
  */
 #define SUDO_HOOK_RET_ERROR    -1      /* error */
 #define SUDO_HOOK_RET_NEXT     0       /* go to the next hook in the list */
-#define SUDO_HOOK_RET_STOP     1       /* stop here, skip the rest of tghe list */
+#define SUDO_HOOK_RET_STOP     1       /* stop hook processing for this type */
 
 /*
  * Hooks for setenv/unsetenv/putenv/getenv.
@@ -100,15 +108,6 @@ struct sudo_hook {
 #define SUDO_HOOK_PUTENV       3
 #define SUDO_HOOK_GETENV       4
 
-/*
- * Hook functions types.
- */
-typedef int (*sudo_hook_fn_t)();
-typedef int (*sudo_hook_fn_setenv_t)(const char *name, const char *value, int overwrite, void *closure);
-typedef int (*sudo_hook_fn_putenv_t)(char *string, void *closure);
-typedef int (*sudo_hook_fn_getenv_t)(const char *name, char **value, void *closure);
-typedef int (*sudo_hook_fn_unsetenv_t)(const char *name, void *closure);
-
 /* Policy plugin type and defines */
 struct passwd;
 struct policy_plugin {