Rename plugin "args" to "options"

This commit is contained in:
Todd C. Miller
2012-03-15 12:32:31 -04:00
parent 741f57e68c
commit 96f046c1ce
16 changed files with 93 additions and 93 deletions

View File

@@ -205,9 +205,9 @@ set_plugin(const char *entry)
{ {
struct plugin_info *info; struct plugin_info *info;
const char *name, *path, *cp, *ep; const char *name, *path, *cp, *ep;
char **args = NULL; char **options = NULL;
size_t namelen, pathlen; size_t namelen, pathlen;
unsigned int nargs; unsigned int nopts;
/* Parse Plugin line */ /* Parse Plugin line */
name = entry; name = entry;
@@ -218,34 +218,34 @@ set_plugin(const char *entry)
while (isblank((unsigned char)*path)) while (isblank((unsigned char)*path))
path++; path++;
if ((cp = strpbrk(path, " \t")) != NULL) { if ((cp = strpbrk(path, " \t")) != NULL) {
/* Convert extra args to an array. */ /* Convert any options to an array. */
pathlen = (size_t)(cp - path); pathlen = (size_t)(cp - path);
while (isblank((unsigned char)*cp)) while (isblank((unsigned char)*cp))
cp++; cp++;
/* Count number of args and allocate array. */ /* Count number of options and allocate array. */
for (ep = cp, nargs = 1; (ep = strpbrk(ep, " \t")) != NULL; nargs++) { for (ep = cp, nopts = 1; (ep = strpbrk(ep, " \t")) != NULL; nopts++) {
while (isblank((unsigned char)*ep)) while (isblank((unsigned char)*ep))
ep++; ep++;
} }
args = emalloc2(nargs + 1, sizeof(*args)); options = emalloc2(nopts + 1, sizeof(*options));
/* Fill in args array, there is at least one element. */ /* Fill in options array, there is at least one element. */
for (nargs = 0; (ep = strpbrk(cp, " \t")) != NULL; ) { for (nopts = 0; (ep = strpbrk(cp, " \t")) != NULL; ) {
args[nargs++] = estrndup(cp, (size_t)(ep - cp)); options[nopts++] = estrndup(cp, (size_t)(ep - cp));
while (isblank((unsigned char)*ep)) while (isblank((unsigned char)*ep))
ep++; ep++;
cp = ep; cp = ep;
} }
args[nargs++] = estrdup(cp); options[nopts++] = estrdup(cp);
args[nargs] = NULL; options[nopts] = NULL;
} else { } else {
/* No extra args. */ /* No extra options. */
pathlen = strlen(path); pathlen = strlen(path);
} }
info = emalloc(sizeof(*info)); info = emalloc(sizeof(*info));
info->symbol_name = estrndup(name, namelen); info->symbol_name = estrndup(name, namelen);
info->path = estrndup(path, pathlen); info->path = estrndup(path, pathlen);
info->args = args; info->options = options;
info->prev = info; info->prev = info;
info->next = NULL; info->next = NULL;
tq_append(&sudo_conf_data.plugins, info); tq_append(&sudo_conf_data.plugins, info);
@@ -353,7 +353,7 @@ done:
info = emalloc(sizeof(*info)); info = emalloc(sizeof(*info));
info->symbol_name = "sudoers_policy"; info->symbol_name = "sudoers_policy";
info->path = SUDOERS_PLUGIN; info->path = SUDOERS_PLUGIN;
info->args = NULL; info->options = NULL;
info->prev = info; info->prev = info;
info->next = NULL; info->next = NULL;
tq_append(&sudo_conf_data.plugins, info); tq_append(&sudo_conf_data.plugins, info);
@@ -362,7 +362,7 @@ done:
info = emalloc(sizeof(*info)); info = emalloc(sizeof(*info));
info->symbol_name = "sudoers_io"; info->symbol_name = "sudoers_io";
info->path = SUDOERS_PLUGIN; info->path = SUDOERS_PLUGIN;
info->args = NULL; info->options = NULL;
info->prev = info; info->prev = info;
info->next = NULL; info->next = NULL;
tq_append(&sudo_conf_data.plugins, info); tq_append(&sudo_conf_data.plugins, info);

View File

@@ -2,7 +2,7 @@
# Sample /etc/sudo.conf file # Sample /etc/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path plugin_args ... # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -13,7 +13,7 @@
# The plugin_path is relative to ${prefix}/libexec unless fully qualified. # The plugin_path is relative to ${prefix}/libexec unless fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
# The sudoers plugin is used by default if no Plugin lines are present. # The sudoers plugin is used by default if no Plugin lines are present.
Plugin sudoers_policy sudoers.so Plugin sudoers_policy sudoers.so

View File

@@ -326,7 +326,7 @@ PPLLUUGGIINNSS
# Default /etc/sudo.conf file # Default /etc/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path plugin_args ... # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -336,7 +336,7 @@ PPLLUUGGIINNSS
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin policy_plugin sudoers.so Plugin policy_plugin sudoers.so
Plugin io_plugin sudoers.so Plugin io_plugin sudoers.so
@@ -624,4 +624,4 @@ DDIISSCCLLAAIIMMEERR
1.8.5 March 14, 2012 SUDO(1m) 1.8.5 March 15, 2012 SUDO(1m)

View File

@@ -149,7 +149,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "SUDO @mansectsu@" .IX Title "SUDO @mansectsu@"
.TH SUDO @mansectsu@ "March 14, 2012" "1.8.5" "MAINTENANCE COMMANDS" .TH SUDO @mansectsu@ "March 15, 2012" "1.8.5" "MAINTENANCE COMMANDS"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@@ -526,7 +526,7 @@ which corresponds to the following \fI@sysconfdir@/sudo.conf\fR file.
\& # Default @sysconfdir@/sudo.conf file \& # Default @sysconfdir@/sudo.conf file
\& # \& #
\& # Format: \& # Format:
\& # Plugin plugin_name plugin_path plugin_args ... \& # Plugin plugin_name plugin_path plugin_options ...
\& # Path askpass /path/to/askpass \& # Path askpass /path/to/askpass
\& # Path noexec /path/to/sudo_noexec.so \& # Path noexec /path/to/sudo_noexec.so
\& # Debug sudo /var/log/sudo_debug all@warn \& # Debug sudo /var/log/sudo_debug all@warn
@@ -536,7 +536,7 @@ which corresponds to the following \fI@sysconfdir@/sudo.conf\fR file.
\& # fully qualified. \& # fully qualified.
\& # The plugin_name corresponds to a global symbol in the plugin \& # The plugin_name corresponds to a global symbol in the plugin
\& # that contains the plugin interface structure. \& # that contains the plugin interface structure.
\& # The plugin_args are optional. \& # The plugin_options are optional.
\& # \& #
\& Plugin policy_plugin sudoers.so \& Plugin policy_plugin sudoers.so
\& Plugin io_plugin sudoers.so \& Plugin io_plugin sudoers.so

View File

@@ -421,7 +421,7 @@ which corresponds to the following F<@sysconfdir@/sudo.conf> file.
# Default @sysconfdir@/sudo.conf file # Default @sysconfdir@/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path plugin_args ... # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -431,7 +431,7 @@ which corresponds to the following F<@sysconfdir@/sudo.conf> file.
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin policy_plugin sudoers.so Plugin policy_plugin sudoers.so
Plugin io_plugin sudoers.so Plugin io_plugin sudoers.so

View File

@@ -32,8 +32,8 @@ DDEESSCCRRIIPPTTIIOONN
io_plugin in the plugin shared object. The _p_a_t_h may be fully qualified io_plugin in the plugin shared object. The _p_a_t_h may be fully qualified
or relative. If not fully qualified it is relative to the or relative. If not fully qualified it is relative to the
_/_u_s_r_/_l_o_c_a_l_/_l_i_b_e_x_e_c directory. Any additional parameters after the _p_a_t_h _/_u_s_r_/_l_o_c_a_l_/_l_i_b_e_x_e_c directory. Any additional parameters after the _p_a_t_h
are passed as arguments to the plugin's _o_p_e_n function. Lines that are passed as options to the plugin's _o_p_e_n function. Lines that don't
don't begin with Plugin, Path, Debug or Set are silently ignored. begin with Plugin, Path, Debug or Set are silently ignored.
The same shared object may contain multiple plugins, each with a The same shared object may contain multiple plugins, each with a
different symbol name. The shared object file must be owned by uid 0 different symbol name. The shared object file must be owned by uid 0
@@ -45,7 +45,7 @@ DDEESSCCRRIIPPTTIIOONN
# Default /etc/sudo.conf file # Default /etc/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path optional_args # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -55,7 +55,7 @@ DDEESSCCRRIIPPTTIIOONN
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin sudoers_policy sudoers.so Plugin sudoers_policy sudoers.so
Plugin sudoers_io sudoers.so Plugin sudoers_io sudoers.so
@@ -74,7 +74,7 @@ DDEESSCCRRIIPPTTIIOONN
int (*open)(unsigned int version, sudo_conv_t conversation, int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], char * const user_env[], char * const user_info[], char * const user_env[],
char * const plugin_args[]); char * const plugin_options[]);
void (*close)(int exit_status, int error); void (*close)(int exit_status, int error);
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*check_policy)(int argc, char * const argv[], int (*check_policy)(int argc, char * const argv[],
@@ -106,7 +106,7 @@ DDEESSCCRRIIPPTTIIOONN
int (*open)(unsigned int version, sudo_conv_t conversation, int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], char * const user_env[], char * const user_info[], char * const user_env[],
char * const plugin_args[]); char * const plugin_options[]);
Returns 1 on success, 0 on failure, -1 if a general error occurred, Returns 1 on success, 0 on failure, -1 if a general error occurred,
or -2 if there was a usage error. In the latter case, ssuuddoo will or -2 if there was a usage error. In the latter case, ssuuddoo will
@@ -319,17 +319,17 @@ DDEESSCCRRIIPPTTIIOONN
equal sign ('=') since the _n_a_m_e field will never include one equal sign ('=') since the _n_a_m_e field will never include one
itself but the _v_a_l_u_e might. itself but the _v_a_l_u_e might.
plugin_args plugin_options
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split treated as arguments to the plugin. These arguments are split
on a white space boundary and are passed to the plugin in the on a white space boundary and are passed to the plugin in the
form of a NULL-terminated array of strings. If no arguments form of a NULL-terminated array of strings. If no arguments
were specified, _p_l_u_g_i_n___a_r_g_s will be the NULL pointer. were specified, _p_l_u_g_i_n___o_p_t_i_o_n_s will be the NULL pointer.
NOTE: the _p_l_u_g_i_n___a_r_g_s parameter is only available starting with NOTE: the _p_l_u_g_i_n___o_p_t_i_o_n_s parameter is only available starting
API version 1.2. A plugin mmuusstt check the API version specified with API version 1.2. A plugin mmuusstt check the API version
by the ssuuddoo front end before using _p_l_u_g_i_n___a_r_g_s. Failure to do specified by the ssuuddoo front end before using _p_l_u_g_i_n___o_p_t_i_o_n_s.
so may result in a crash. Failure to do so may result in a crash.
close close
void (*close)(int exit_status, int error); void (*close)(int exit_status, int error);
@@ -730,7 +730,7 @@ DDEESSCCRRIIPPTTIIOONN
int (*open)(unsigned int version, sudo_conv_t conversation int (*open)(unsigned int version, sudo_conv_t conversation
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], int argc, char * const argv[], char * const user_info[], int argc, char * const argv[],
char * const user_env[], char * const plugin_args[]); char * const user_env[], char * const plugin_options[]);
void (*close)(int exit_status, int error); /* wait status or error */ void (*close)(int exit_status, int error); /* wait status or error */
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*log_ttyin)(const char *buf, unsigned int len); int (*log_ttyin)(const char *buf, unsigned int len);
@@ -777,7 +777,7 @@ DDEESSCCRRIIPPTTIIOONN
int (*open)(unsigned int version, sudo_conv_t conversation int (*open)(unsigned int version, sudo_conv_t conversation
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], int argc, char * const argv[], char * const user_info[], int argc, char * const argv[],
char * const user_env[], char * const plugin_args[]); char * const user_env[], char * const plugin_options[]);
The _o_p_e_n function is run before the _l_o_g___i_n_p_u_t, _l_o_g___o_u_t_p_u_t or The _o_p_e_n function is run before the _l_o_g___i_n_p_u_t, _l_o_g___o_u_t_p_u_t or
_s_h_o_w___v_e_r_s_i_o_n functions are called. It is only called if the _s_h_o_w___v_e_r_s_i_o_n functions are called. It is only called if the
@@ -854,17 +854,17 @@ DDEESSCCRRIIPPTTIIOONN
equal sign ('=') since the _n_a_m_e field will never include one equal sign ('=') since the _n_a_m_e field will never include one
itself but the _v_a_l_u_e might. itself but the _v_a_l_u_e might.
plugin_args plugin_options
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split treated as arguments to the plugin. These arguments are split
on a white space boundary and are passed to the plugin in the on a white space boundary and are passed to the plugin in the
form of a NULL-terminated array of strings. If no arguments form of a NULL-terminated array of strings. If no arguments
were specified, _p_l_u_g_i_n___a_r_g_s will be the NULL pointer. were specified, _p_l_u_g_i_n___o_p_t_i_o_n_s will be the NULL pointer.
NOTE: the _p_l_u_g_i_n___a_r_g_s parameter is only available starting with NOTE: the _p_l_u_g_i_n___o_p_t_i_o_n_s parameter is only available starting
API version 1.2. A plugin mmuusstt check the API version specified with API version 1.2. A plugin mmuusstt check the API version
by the ssuuddoo front end before using _p_l_u_g_i_n___a_r_g_s. Failure to do specified by the ssuuddoo front end before using _p_l_u_g_i_n___o_p_t_i_o_n_s.
so may result in a crash. Failure to do so may result in a crash.
close close
void (*close)(int exit_status, int error); void (*close)(int exit_status, int error);

View File

@@ -174,7 +174,7 @@ plugin. The \fIsymbol_name\fR is the name of the \f(CW\*(C`struct policy_plugin
or \f(CW\*(C`struct io_plugin\*(C'\fR in the plugin shared object. The \fIpath\fR or \f(CW\*(C`struct io_plugin\*(C'\fR in the plugin shared object. The \fIpath\fR
may be fully qualified or relative. If not fully qualified it is may be fully qualified or relative. If not fully qualified it is
relative to the \fI@prefix@/libexec\fR directory. Any additional relative to the \fI@prefix@/libexec\fR directory. Any additional
parameters after the \fIpath\fR are passed as arguments to the plugin's parameters after the \fIpath\fR are passed as options to the plugin's
\&\fIopen\fR function. Lines that don't begin with \f(CW\*(C`Plugin\*(C'\fR, \f(CW\*(C`Path\*(C'\fR, \&\fIopen\fR function. Lines that don't begin with \f(CW\*(C`Plugin\*(C'\fR, \f(CW\*(C`Path\*(C'\fR,
\&\f(CW\*(C`Debug\*(C'\fR or \f(CW\*(C`Set\*(C'\fR are silently ignored. \&\f(CW\*(C`Debug\*(C'\fR or \f(CW\*(C`Set\*(C'\fR are silently ignored.
.PP .PP
@@ -189,7 +189,7 @@ This limitation does not apply to I/O plugins.
\& # Default @sysconfdir@/sudo.conf file \& # Default @sysconfdir@/sudo.conf file
\& # \& #
\& # Format: \& # Format:
\& # Plugin plugin_name plugin_path optional_args \& # Plugin plugin_name plugin_path plugin_options ...
\& # Path askpass /path/to/askpass \& # Path askpass /path/to/askpass
\& # Path noexec /path/to/sudo_noexec.so \& # Path noexec /path/to/sudo_noexec.so
\& # Debug sudo /var/log/sudo_debug all@warn \& # Debug sudo /var/log/sudo_debug all@warn
@@ -199,7 +199,7 @@ This limitation does not apply to I/O plugins.
\& # fully qualified. \& # fully qualified.
\& # The plugin_name corresponds to a global symbol in the plugin \& # The plugin_name corresponds to a global symbol in the plugin
\& # that contains the plugin interface structure. \& # that contains the plugin interface structure.
\& # The plugin_args are optional. \& # The plugin_options are optional.
\& # \& #
\& Plugin sudoers_policy sudoers.so \& Plugin sudoers_policy sudoers.so
\& Plugin sudoers_io sudoers.so \& Plugin sudoers_io sudoers.so
@@ -220,7 +220,7 @@ so that \fBsudo\fR can load it.
\& int (*open)(unsigned int version, sudo_conv_t conversation, \& int (*open)(unsigned int version, sudo_conv_t conversation,
\& sudo_printf_t plugin_printf, char * const settings[], \& sudo_printf_t plugin_printf, char * const settings[],
\& char * const user_info[], char * const user_env[], \& char * const user_info[], char * const user_env[],
\& char * const plugin_args[]); \& char * const plugin_options[]);
\& void (*close)(int exit_status, int error); \& void (*close)(int exit_status, int error);
\& int (*show_version)(int verbose); \& int (*show_version)(int verbose);
\& int (*check_policy)(int argc, char * const argv[], \& int (*check_policy)(int argc, char * const argv[],
@@ -254,7 +254,7 @@ built against.
\& int (*open)(unsigned int version, sudo_conv_t conversation, \& int (*open)(unsigned int version, sudo_conv_t conversation,
\& sudo_printf_t plugin_printf, char * const settings[], \& sudo_printf_t plugin_printf, char * const settings[],
\& char * const user_info[], char * const user_env[], \& char * const user_info[], char * const user_env[],
\& char * const plugin_args[]); \& char * const plugin_options[]);
.Ve .Ve
.Sp .Sp
Returns 1 on success, 0 on failure, \-1 if a general error occurred, Returns 1 on success, 0 on failure, \-1 if a general error occurred,
@@ -468,17 +468,17 @@ The user's environment in the form of a \f(CW\*(C`NULL\*(C'\fR\-terminated vecto
When parsing \fIuser_env\fR, the plugin should split on the \fBfirst\fR When parsing \fIuser_env\fR, the plugin should split on the \fBfirst\fR
equal sign ('=') since the \fIname\fR field will never include one equal sign ('=') since the \fIname\fR field will never include one
itself but the \fIvalue\fR might. itself but the \fIvalue\fR might.
.IP "plugin_args" 4 .IP "plugin_options" 4
.IX Item "plugin_args" .IX Item "plugin_options"
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split on treated as arguments to the plugin. These arguments are split on
a white space boundary and are passed to the plugin in the form of a white space boundary and are passed to the plugin in the form of
a \f(CW\*(C`NULL\*(C'\fR\-terminated array of strings. If no arguments were a \f(CW\*(C`NULL\*(C'\fR\-terminated array of strings. If no arguments were
specified, \fIplugin_args\fR will be the \s-1NULL\s0 pointer. specified, \fIplugin_options\fR will be the \s-1NULL\s0 pointer.
.Sp .Sp
\&\s-1NOTE:\s0 the \fIplugin_args\fR parameter is only available starting with \&\s-1NOTE:\s0 the \fIplugin_options\fR parameter is only available starting with
\&\s-1API\s0 version 1.2. A plugin \fBmust\fR check the \s-1API\s0 version specified \&\s-1API\s0 version 1.2. A plugin \fBmust\fR check the \s-1API\s0 version specified
by the \fBsudo\fR front end before using \fIplugin_args\fR. Failure to by the \fBsudo\fR front end before using \fIplugin_options\fR. Failure to
do so may result in a crash. do so may result in a crash.
.RE .RE
.RS 4 .RS 4
@@ -909,7 +909,7 @@ version 1.2 or higher, \f(CW\*(C`deregister_hooks\*(C'\fR will not be called.
\& int (*open)(unsigned int version, sudo_conv_t conversation \& int (*open)(unsigned int version, sudo_conv_t conversation
\& sudo_printf_t plugin_printf, char * const settings[], \& sudo_printf_t plugin_printf, char * const settings[],
\& char * const user_info[], int argc, char * const argv[], \& char * const user_info[], int argc, char * const argv[],
\& char * const user_env[], char * const plugin_args[]); \& char * const user_env[], char * const plugin_options[]);
\& void (*close)(int exit_status, int error); /* wait status or error */ \& void (*close)(int exit_status, int error); /* wait status or error */
\& int (*show_version)(int verbose); \& int (*show_version)(int verbose);
\& int (*log_ttyin)(const char *buf, unsigned int len); \& int (*log_ttyin)(const char *buf, unsigned int len);
@@ -959,7 +959,7 @@ built against.
\& int (*open)(unsigned int version, sudo_conv_t conversation \& int (*open)(unsigned int version, sudo_conv_t conversation
\& sudo_printf_t plugin_printf, char * const settings[], \& sudo_printf_t plugin_printf, char * const settings[],
\& char * const user_info[], int argc, char * const argv[], \& char * const user_info[], int argc, char * const argv[],
\& char * const user_env[], char * const plugin_args[]); \& char * const user_env[], char * const plugin_options[]);
.Ve .Ve
.Sp .Sp
The \fIopen\fR function is run before the \fIlog_input\fR, \fIlog_output\fR The \fIopen\fR function is run before the \fIlog_input\fR, \fIlog_output\fR
@@ -1034,17 +1034,17 @@ The user's environment in the form of a \f(CW\*(C`NULL\*(C'\fR\-terminated vecto
When parsing \fIuser_env\fR, the plugin should split on the \fBfirst\fR When parsing \fIuser_env\fR, the plugin should split on the \fBfirst\fR
equal sign ('=') since the \fIname\fR field will never include one equal sign ('=') since the \fIname\fR field will never include one
itself but the \fIvalue\fR might. itself but the \fIvalue\fR might.
.IP "plugin_args" 4 .IP "plugin_options" 4
.IX Item "plugin_args" .IX Item "plugin_options"
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split on treated as arguments to the plugin. These arguments are split on
a white space boundary and are passed to the plugin in the form of a white space boundary and are passed to the plugin in the form of
a \f(CW\*(C`NULL\*(C'\fR\-terminated array of strings. If no arguments were a \f(CW\*(C`NULL\*(C'\fR\-terminated array of strings. If no arguments were
specified, \fIplugin_args\fR will be the \s-1NULL\s0 pointer. specified, \fIplugin_options\fR will be the \s-1NULL\s0 pointer.
.Sp .Sp
\&\s-1NOTE:\s0 the \fIplugin_args\fR parameter is only available starting with \&\s-1NOTE:\s0 the \fIplugin_options\fR parameter is only available starting with
\&\s-1API\s0 version 1.2. A plugin \fBmust\fR check the \s-1API\s0 version specified \&\s-1API\s0 version 1.2. A plugin \fBmust\fR check the \s-1API\s0 version specified
by the \fBsudo\fR front end before using \fIplugin_args\fR. Failure to by the \fBsudo\fR front end before using \fIplugin_options\fR. Failure to
do so may result in a crash. do so may result in a crash.
.RE .RE
.RS 4 .RS 4

View File

@@ -48,7 +48,7 @@ plugin. The I<symbol_name> is the name of the C<struct policy_plugin>
or C<struct io_plugin> in the plugin shared object. The I<path> or C<struct io_plugin> in the plugin shared object. The I<path>
may be fully qualified or relative. If not fully qualified it is may be fully qualified or relative. If not fully qualified it is
relative to the F<@prefix@/libexec> directory. Any additional relative to the F<@prefix@/libexec> directory. Any additional
parameters after the I<path> are passed as arguments to the plugin's parameters after the I<path> are passed as options to the plugin's
I<open> function. Lines that don't begin with C<Plugin>, C<Path>, I<open> function. Lines that don't begin with C<Plugin>, C<Path>,
C<Debug> or C<Set> are silently ignored. C<Debug> or C<Set> are silently ignored.
@@ -62,7 +62,7 @@ This limitation does not apply to I/O plugins.
# Default @sysconfdir@/sudo.conf file # Default @sysconfdir@/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path optional_args # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -72,7 +72,7 @@ This limitation does not apply to I/O plugins.
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin sudoers_policy sudoers.so Plugin sudoers_policy sudoers.so
Plugin sudoers_io sudoers.so Plugin sudoers_io sudoers.so
@@ -92,7 +92,7 @@ so that B<sudo> can load it.
int (*open)(unsigned int version, sudo_conv_t conversation, int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], char * const user_env[], char * const user_info[], char * const user_env[],
char * const plugin_args[]); char * const plugin_options[]);
void (*close)(int exit_status, int error); void (*close)(int exit_status, int error);
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*check_policy)(int argc, char * const argv[], int (*check_policy)(int argc, char * const argv[],
@@ -129,7 +129,7 @@ built against.
int (*open)(unsigned int version, sudo_conv_t conversation, int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], char * const user_env[], char * const user_info[], char * const user_env[],
char * const plugin_args[]); char * const plugin_options[]);
Returns 1 on success, 0 on failure, -1 if a general error occurred, Returns 1 on success, 0 on failure, -1 if a general error occurred,
or -2 if there was a usage error. In the latter case, B<sudo> will or -2 if there was a usage error. In the latter case, B<sudo> will
@@ -380,17 +380,17 @@ When parsing I<user_env>, the plugin should split on the B<first>
equal sign ('=') since the I<name> field will never include one equal sign ('=') since the I<name> field will never include one
itself but the I<value> might. itself but the I<value> might.
=item plugin_args =item plugin_options
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split on treated as arguments to the plugin. These arguments are split on
a white space boundary and are passed to the plugin in the form of a white space boundary and are passed to the plugin in the form of
a C<NULL>-terminated array of strings. If no arguments were a C<NULL>-terminated array of strings. If no arguments were
specified, I<plugin_args> will be the NULL pointer. specified, I<plugin_options> will be the NULL pointer.
NOTE: the I<plugin_args> parameter is only available starting with NOTE: the I<plugin_options> parameter is only available starting with
API version 1.2. A plugin B<must> check the API version specified API version 1.2. A plugin B<must> check the API version specified
by the B<sudo> front end before using I<plugin_args>. Failure to by the B<sudo> front end before using I<plugin_options>. Failure to
do so may result in a crash. do so may result in a crash.
=back =back
@@ -850,7 +850,7 @@ version 1.2 or higher, C<deregister_hooks> will not be called.
int (*open)(unsigned int version, sudo_conv_t conversation int (*open)(unsigned int version, sudo_conv_t conversation
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], int argc, char * const argv[], char * const user_info[], int argc, char * const argv[],
char * const user_env[], char * const plugin_args[]); char * const user_env[], char * const plugin_options[]);
void (*close)(int exit_status, int error); /* wait status or error */ void (*close)(int exit_status, int error); /* wait status or error */
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*log_ttyin)(const char *buf, unsigned int len); int (*log_ttyin)(const char *buf, unsigned int len);
@@ -903,7 +903,7 @@ built against.
int (*open)(unsigned int version, sudo_conv_t conversation int (*open)(unsigned int version, sudo_conv_t conversation
sudo_printf_t plugin_printf, char * const settings[], sudo_printf_t plugin_printf, char * const settings[],
char * const user_info[], int argc, char * const argv[], char * const user_info[], int argc, char * const argv[],
char * const user_env[], char * const plugin_args[]); char * const user_env[], char * const plugin_options[]);
The I<open> function is run before the I<log_input>, I<log_output> The I<open> function is run before the I<log_input>, I<log_output>
or I<show_version> functions are called. It is only called if the or I<show_version> functions are called. It is only called if the
@@ -987,17 +987,17 @@ When parsing I<user_env>, the plugin should split on the B<first>
equal sign ('=') since the I<name> field will never include one equal sign ('=') since the I<name> field will never include one
itself but the I<value> might. itself but the I<value> might.
=item plugin_args =item plugin_options
Any (non-comment) strings immediately after the plugin path are Any (non-comment) strings immediately after the plugin path are
treated as arguments to the plugin. These arguments are split on treated as arguments to the plugin. These arguments are split on
a white space boundary and are passed to the plugin in the form of a white space boundary and are passed to the plugin in the form of
a C<NULL>-terminated array of strings. If no arguments were a C<NULL>-terminated array of strings. If no arguments were
specified, I<plugin_args> will be the NULL pointer. specified, I<plugin_options> will be the NULL pointer.
NOTE: the I<plugin_args> parameter is only available starting with NOTE: the I<plugin_options> parameter is only available starting with
API version 1.2. A plugin B<must> check the API version specified API version 1.2. A plugin B<must> check the API version specified
by the B<sudo> front end before using I<plugin_args>. Failure to by the B<sudo> front end before using I<plugin_options>. Failure to
do so may result in a crash. do so may result in a crash.
=back =back

View File

@@ -1350,7 +1350,7 @@ SSUUDDOO..CCOONNFF
# Default /etc/sudo.conf file # Default /etc/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path plugin_args ... # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -1360,7 +1360,7 @@ SSUUDDOO..CCOONNFF
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin policy_plugin sudoers.so Plugin policy_plugin sudoers.so
Plugin io_plugin sudoers.so Plugin io_plugin sudoers.so
@@ -1806,4 +1806,4 @@ DDIISSCCLLAAIIMMEERR
1.8.5 March 14, 2012 SUDOERS(4) 1.8.5 March 15, 2012 SUDOERS(4)

View File

@@ -148,7 +148,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "SUDOERS @mansectform@" .IX Title "SUDOERS @mansectform@"
.TH SUDOERS @mansectform@ "March 14, 2012" "1.8.5" "MAINTENANCE COMMANDS" .TH SUDOERS @mansectform@ "March 15, 2012" "1.8.5" "MAINTENANCE COMMANDS"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@@ -1644,7 +1644,7 @@ the following \fI@sysconfdir@/sudo.conf\fR file.
\& # Default @sysconfdir@/sudo.conf file \& # Default @sysconfdir@/sudo.conf file
\& # \& #
\& # Format: \& # Format:
\& # Plugin plugin_name plugin_path plugin_args ... \& # Plugin plugin_name plugin_path plugin_options ...
\& # Path askpass /path/to/askpass \& # Path askpass /path/to/askpass
\& # Path noexec /path/to/sudo_noexec.so \& # Path noexec /path/to/sudo_noexec.so
\& # Debug sudo /var/log/sudo_debug all@warn \& # Debug sudo /var/log/sudo_debug all@warn
@@ -1654,7 +1654,7 @@ the following \fI@sysconfdir@/sudo.conf\fR file.
\& # fully qualified. \& # fully qualified.
\& # The plugin_name corresponds to a global symbol in the plugin \& # The plugin_name corresponds to a global symbol in the plugin
\& # that contains the plugin interface structure. \& # that contains the plugin interface structure.
\& # The plugin_args are optional. \& # The plugin_options are optional.
\& # \& #
\& Plugin policy_plugin sudoers.so \& Plugin policy_plugin sudoers.so
\& Plugin io_plugin sudoers.so \& Plugin io_plugin sudoers.so

View File

@@ -1606,7 +1606,7 @@ the following F<@sysconfdir@/sudo.conf> file.
# Default @sysconfdir@/sudo.conf file # Default @sysconfdir@/sudo.conf file
# #
# Format: # Format:
# Plugin plugin_name plugin_path plugin_args ... # Plugin plugin_name plugin_path plugin_options ...
# Path askpass /path/to/askpass # Path askpass /path/to/askpass
# Path noexec /path/to/sudo_noexec.so # Path noexec /path/to/sudo_noexec.so
# Debug sudo /var/log/sudo_debug all@warn # Debug sudo /var/log/sudo_debug all@warn
@@ -1616,7 +1616,7 @@ the following F<@sysconfdir@/sudo.conf> file.
# fully qualified. # fully qualified.
# The plugin_name corresponds to a global symbol in the plugin # The plugin_name corresponds to a global symbol in the plugin
# that contains the plugin interface structure. # that contains the plugin interface structure.
# The plugin_args are optional. # The plugin_options are optional.
# #
Plugin policy_plugin sudoers.so Plugin policy_plugin sudoers.so
Plugin io_plugin sudoers.so Plugin io_plugin sudoers.so

View File

@@ -24,7 +24,7 @@ struct plugin_info {
struct plugin_info *next; /* required */ struct plugin_info *next; /* required */
const char *path; const char *path;
const char *symbol_name; const char *symbol_name;
char * const * args; char * const * options;
}; };
TQ_DECLARE(plugin_info) TQ_DECLARE(plugin_info)

View File

@@ -117,7 +117,7 @@ struct policy_plugin {
int (*open)(unsigned int version, sudo_conv_t conversation, int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t sudo_printf, char * const settings[], sudo_printf_t sudo_printf, char * const settings[],
char * const user_info[], char * const user_env[], char * const user_info[], char * const user_env[],
char * const plugin_args[]); char * const plugin_plugins[]);
void (*close)(int exit_status, int error); /* wait status or error */ void (*close)(int exit_status, int error); /* wait status or error */
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*check_policy)(int argc, char * const argv[], int (*check_policy)(int argc, char * const argv[],
@@ -141,7 +141,7 @@ struct io_plugin {
sudo_printf_t sudo_printf, char * const settings[], sudo_printf_t sudo_printf, char * const settings[],
char * const user_info[], char * const command_info[], char * const user_info[], char * const command_info[],
int argc, char * const argv[], char * const user_env[], int argc, char * const argv[], char * const user_env[],
char * const plugin_args[]); char * const plugin_plugins[]);
void (*close)(int exit_status, int error); /* wait status or error */ void (*close)(int exit_status, int error); /* wait status or error */
int (*show_version)(int verbose); int (*show_version)(int verbose);
int (*log_ttyin)(const char *buf, unsigned int len); int (*log_ttyin)(const char *buf, unsigned int len);

View File

@@ -131,7 +131,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
} }
policy_plugin->handle = handle; policy_plugin->handle = handle;
policy_plugin->name = info->symbol_name; policy_plugin->name = info->symbol_name;
policy_plugin->args = info->args; policy_plugin->options = info->options;
policy_plugin->u.generic = plugin; policy_plugin->u.generic = plugin;
} else if (plugin->type == SUDO_IO_PLUGIN) { } else if (plugin->type == SUDO_IO_PLUGIN) {
container = emalloc(sizeof(*container)); container = emalloc(sizeof(*container));
@@ -139,7 +139,7 @@ sudo_load_plugins(struct plugin_container *policy_plugin,
container->next = NULL; container->next = NULL;
container->handle = handle; container->handle = handle;
container->name = info->symbol_name; container->name = info->symbol_name;
container->args = info->args; container->options = info->options;
container->u.generic = plugin; container->u.generic = plugin;
tq_append(io_plugins, container); tq_append(io_plugins, container);
} }

View File

@@ -1065,7 +1065,7 @@ policy_open(struct plugin_container *plugin, char * const settings[],
break; break;
default: default:
rval = plugin->u.policy->open(SUDO_API_VERSION, sudo_conversation, rval = plugin->u.policy->open(SUDO_API_VERSION, sudo_conversation,
_sudo_printf, settings, user_info, user_env, plugin->args); _sudo_printf, settings, user_info, user_env, plugin->options);
} }
debug_return_bool(rval); debug_return_bool(rval);
@@ -1180,7 +1180,7 @@ iolog_open(struct plugin_container *plugin, char * const settings[],
default: default:
rval = plugin->u.io->open(SUDO_API_VERSION, sudo_conversation, rval = plugin->u.io->open(SUDO_API_VERSION, sudo_conversation,
_sudo_printf, settings, user_info, command_info, _sudo_printf, settings, user_info, command_info,
argc, argv, user_env, plugin->args); argc, argv, user_env, plugin->options);
} }
debug_return_bool(rval); debug_return_bool(rval);
} }

View File

@@ -84,7 +84,7 @@ struct plugin_container {
struct plugin_container *prev; /* required */ struct plugin_container *prev; /* required */
struct plugin_container *next; /* required */ struct plugin_container *next; /* required */
const char *name; const char *name;
char * const *args; char * const *options;
void *handle; void *handle;
union { union {
struct generic_plugin *generic; struct generic_plugin *generic;