Pass plugin path in the settings array.

This commit is contained in:
Todd C. Miller
2014-10-22 13:13:00 -06:00
parent 1e0b8903f2
commit 346ff6766e
7 changed files with 44 additions and 3 deletions

View File

@@ -178,6 +178,11 @@ DDEESSCCRRIIPPTTIIOONN
plugin was loaded from. It may be used by a plugin to
locate support files.
plugin_path=string
The path name of plugin loaded by the ssuuddoo front end.
The path name will be a fully-qualified unless the
plugin was statically compiled into ssuuddoo.
preserve_environment=bool
Set to true if the user specified the --EE flag,
indicating that the user wishes to preserve the
@@ -1462,6 +1467,9 @@ PPLLUUGGIINN AAPPII CCHHAANNGGEELLOOGG
Previously, output from the command would be displayed to the
terminal even if an output logging function returned 0.
Version 1.7 (sudo 1.8.12)
The _p_l_u_g_i_n___p_a_t_h entry was added to the settings list.
SSEEEE AALLSSOO
sudo.conf(4), sudoers(4), sudo(1m)

View File

@@ -304,6 +304,14 @@ This is the default directory set at compile time and may not
correspond to the directory the running plugin was loaded from.
It may be used by a plugin to locate support files.
.TP 6n
plugin_path=string
The path name of plugin loaded by the
\fBsudo\fR
front end.
The path name will be a fully-qualified unless the plugin was
statically compiled into
\fBsudo\fR.
.TP 6n
preserve_environment=bool
Set to true if the user specified the
\fB\-E\fR
@@ -2608,6 +2616,13 @@ function returned an error.
The behavior when an I/O logging plugin returns 0 has changed.
Previously, output from the command would be displayed to the
terminal even if an output logging function returned 0.
.TP 6n
Version 1.7 (sudo 1.8.12)
The
\fIplugin_path\fR
entry was added to the
\fRsettings\fR
list.
.SH "SEE ALSO"
sudo.conf(@mansectform@),
sudoers(@mansectform@),

View File

@@ -275,6 +275,13 @@ front end.
This is the default directory set at compile time and may not
correspond to the directory the running plugin was loaded from.
It may be used by a plugin to locate support files.
.It plugin_path=string
The path name of plugin loaded by the
.Nm sudo
front end.
The path name will be a fully-qualified unless the plugin was
statically compiled into
.Nm sudo .
.It preserve_environment=bool
Set to true if the user specified the
.Fl E
@@ -2279,6 +2286,12 @@ function returned an error.
The behavior when an I/O logging plugin returns 0 has changed.
Previously, output from the command would be displayed to the
terminal even if an output logging function returned 0.
.It Version 1.7 (sudo 1.8.12)
The
.Em plugin_path
entry was added to the
.Li settings
list.
.El
.Sh SEE ALSO
.Xr sudo.conf @mansectform@ ,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2009-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -19,7 +19,7 @@
/* API version major/minor */
#define SUDO_API_VERSION_MAJOR 1
#define SUDO_API_VERSION_MINOR 6
#define SUDO_API_VERSION_MINOR 7
#define SUDO_API_MKVERSION(x, y) ((x << 16) | y)
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR, SUDO_API_VERSION_MINOR)

View File

@@ -237,6 +237,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
}
if (handle != NULL) {
policy_plugin->handle = handle;
policy_plugin->path = sudo_estrdup(path);
policy_plugin->name = info->symbol_name;
policy_plugin->options = info->options;
policy_plugin->u.generic = plugin;
@@ -255,6 +256,7 @@ sudo_load_plugin(struct plugin_container *policy_plugin,
if (handle != NULL) {
container = sudo_ecalloc(1, sizeof(*container));
container->handle = handle;
container->path = sudo_estrdup(path);
container->name = info->symbol_name;
container->options = info->options;
container->u.generic = plugin;

View File

@@ -1091,6 +1091,8 @@ format_plugin_settings(struct plugin_container *plugin,
debug_decl(format_plugin_settings, SUDO_DEBUG_PCOMM)
plugin_settings = sudo_emallocarray(plugin_settings_size, sizeof(char *));
plugin_settings[num_plugin_settings++] =
sudo_new_key_val("plugin_path", plugin->path);
while (settings->name != NULL) {
if (settings->value != NULL) {
sudo_debug_printf(SUDO_DEBUG_INFO, "settings: %s=%s",

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010-2013 Todd C. Miller <Todd.Miller@courtesan.com>
* Copyright (c) 2010-2014 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -83,6 +83,7 @@ struct io_plugin_1_1 {
struct plugin_container {
TAILQ_ENTRY(plugin_container) entries;
const char *name;
const char *path;
char * const *options;
void *handle;
union {