Initial cut at a hooks implementation. The plugin can register

hooks for getenv, putenv, setenv and unsetenv.  This makes it
possible for the plugin to trap changes to the environment made by
authentication methods such as PAM or BSD auth so that such changes
are reflected in the environment passed back to sudo for execve().
This commit is contained in:
Todd C. Miller
2012-03-07 16:35:42 -05:00
parent 1504256134
commit 37770ecf1e
24 changed files with 1086 additions and 282 deletions

View File

@@ -155,6 +155,16 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
goto done;
}
/* Install hooks (XXX - later). */
if (policy_plugin->u.policy->version >= SUDO_API_MKVERSION(1, 2)) {
if (policy_plugin->u.policy->register_hooks != NULL)
policy_plugin->u.policy->register_hooks(SUDO_HOOK_VERSION, register_hook);
tq_foreach_fwd(io_plugins, container) {
if (container->u.io->register_hooks != NULL)
container->u.io->register_hooks(SUDO_HOOK_VERSION, register_hook);
}
}
rval = true;
done: