From: Todd C. Miller Date: Tue, 13 Mar 2012 21:32:50 +0000 (-0400) Subject: Use sudo_hook_fn_t in struct sudo_hook. X-Git-Tag: SUDO_1_8_5~1^2~151 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e11069932c4feea3a93e3cc57ead926c1f36f11;p=sudo Use sudo_hook_fn_t in struct sudo_hook. --- diff --git a/include/sudo_plugin.h b/include/sudo_plugin.h index 4269b7158..36d23d298 100644 --- a/include/sudo_plugin.h +++ b/include/sudo_plugin.h @@ -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 {