- Add missing return information for show_version().
- Fix prototypes for several function pointers.
- Update SUDO_API_VERSION_MINOR.
- Add missing references to log_suspend() and change_winsize().
- Add missing "array.".
- Clarify that argc can be zero on sudo -V.
- Clarify size requirements for conversation array arguments.
- Clarify timeout zero value for struct sudo_conv_message.
- Clarify initial and final state of reply in struct sudo_conv_reply.
function using SUDO_CONV_INFO_MSG. If the user requests detailed
version information, the verbose flag will be set.
+ Returns 1 on success, 0 on failure, -1 if a general error occurred,
+ or -2 if there was a usage error, although the return value is
+ currently ignored.
+
check_policy
- int (*check_policy)(int argc, char * const argv[]
+ int (*check_policy)(int argc, char * const argv[],
char *env_add[], char **command_info[],
char **argv_out[], char **user_env_out[]);
populating the vector.
list
- int (*list)(int verbose, const char *list_user,
- int argc, char * const argv[]);
+ int (*list)(int argc, char * const argv[],
+ int verbose, const char *list_user);
List available privileges for the invoking user. Returns 1 on
success, 0 on failure and -1 on error. On error, the plugin may
/* Plugin API version major/minor. */
#define SUDO_API_VERSION_MAJOR 1
- #define SUDO_API_VERSION_MINOR 2
+ #define SUDO_API_VERSION_MINOR 13
#define SUDO_API_MKVERSION(x, y) ((x << 16) | y)
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR,\
SUDO_API_VERSION_MINOR)
open
int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[],
- char * const user_info[], int argc, char * const argv[],
- char * const user_env[], char * const plugin_options[]);
+ char * const user_info[], char * const command_info[],
+ int argc, char * const argv[], char * const user_env[],
+ char * const plugin_options[]);
The o\bop\bpe\ben\bn() function is run before the l\blo\bog\bg_\b_t\btt\bty\byi\bin\bn(), l\blo\bog\bg_\b_t\btt\bty\byo\bou\but\bt(),
- l\blo\bog\bg_\b_s\bst\btd\bdi\bin\bn(), l\blo\bog\bg_\b_s\bst\btd\bdo\bou\but\bt(), l\blo\bog\bg_\b_s\bst\btd\bde\ber\brr\br(), or s\bsh\bho\bow\bw_\b_v\bve\ber\brs\bsi\bio\bon\bn()
- functions are called. It is only called if the version is being
- requested or if the policy plugin's c\bch\bhe\bec\bck\bk_\b_p\bpo\bol\bli\bic\bcy\by() function has
- returned successfully. It 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, s\bsu\bud\bdo\bo will print a usage message before it exits.
- If an error occurs, the plugin may optionally call the
- c\bco\bon\bnv\bve\ber\brs\bsa\bat\bti\bio\bon\bn() or p\bpl\blu\bug\bgi\bin\bn_\b_p\bpr\bri\bin\bnt\btf\bf() function with SUDO_CONF_ERROR_MSG
- to present additional error information to the user.
+ l\blo\bog\bg_\b_s\bst\btd\bdi\bin\bn(), l\blo\bog\bg_\b_s\bst\btd\bdo\bou\but\bt(), l\blo\bog\bg_\b_s\bst\btd\bde\ber\brr\br(), l\blo\bog\bg_\b_s\bsu\bus\bsp\bpe\ben\bnd\bd(),
+ c\bch\bha\ban\bng\bge\be_\b_w\bwi\bin\bns\bsi\biz\bze\be(), or s\bsh\bho\bow\bw_\b_v\bve\ber\brs\bsi\bio\bon\bn() functions are called. It is
+ only called if the version is being requested or if the policy
+ plugin's c\bch\bhe\bec\bck\bk_\b_p\bpo\bol\bli\bic\bcy\by() function has returned successfully. It
+ 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, s\bsu\bud\bdo\bo will
+ print a usage message before it exits. If an error occurs, the
+ plugin may optionally call the c\bco\bon\bnv\bve\ber\brs\bsa\bat\bti\bio\bon\bn() or p\bpl\blu\bug\bgi\bin\bn_\b_p\bpr\bri\bin\bnt\btf\bf()
+ function with SUDO_CONF_ERROR_MSG to present additional error
+ information to the user.
The function arguments are as follows:
strings.
argc The number of elements in _\ba_\br_\bg_\bv, not counting the final NULL
- pointer.
+ pointer. It can be zero, when s\bsu\bud\bdo\bo is called with -\b-V\bV.
argv If non-NULL, an argument vector describing a command the user
wishes to run in the same form as what would be passed to the
function using SUDO_CONV_INFO_MSG. If the user requests detailed
version information, the verbose flag will be set.
+ Returns 1 on success, 0 on failure, -1 if a general error occurred,
+ or -2 if there was a usage error, although the return value is
+ currently ignored.
+
log_ttyin
int (*log_ttyin)(const char *buf, unsigned int len);
To use the c\bco\bon\bnv\bve\ber\brs\bsa\bat\bti\bio\bon\bn() function, the plugin must pass an array of
sudo_conv_message and sudo_conv_reply structures. There must be a struct
sudo_conv_message and struct sudo_conv_reply for each message in the
- conversation. The struct sudo_conv_callback pointer, if not NULL, should
- contain function pointers to be called when the s\bsu\bud\bdo\bo process is suspended
- and/or resumed during conversation input. The _\bo_\bn_\b__\bs_\bu_\bs_\bp_\be_\bn_\bd and _\bo_\bn_\b__\br_\be_\bs_\bu_\bm_\be
+ conversation, that is, both arrays must have the same number of elements.
+ Each struct sudo_conv_reply must have its _\br_\be_\bp_\bl_\by member initialized to
+ NULL. The struct sudo_conv_callback pointer, if not NULL, should contain
+ function pointers to be called when the s\bsu\bud\bdo\bo process is suspended and/or
+ resumed during conversation input. The _\bo_\bn_\b__\bs_\bu_\bs_\bp_\be_\bn_\bd and _\bo_\bn_\b__\br_\be_\bs_\bu_\bm_\be
functions are called with the signal that caused s\bsu\bud\bdo\bo to be suspended and
the _\bc_\bl_\bo_\bs_\bu_\br_\be pointer from the struct sudo_conv_callback. These functions
should return 0 on success and -1 on error. On error, the conversation
SUDO_CONV_PROMPT_ECHO_OFF
Prompt the user for input with echo disabled; this is generally
- used for passwords. The reply will be stored in the _\br_\be_\bp_\bl_\bi_\be_\bs array.
+ used for passwords. The reply will be stored in the _\br_\be_\bp_\bl_\bi_\be_\bs array,
+ and it will never be NULL.
SUDO_CONV_PROMPT_ECHO_ON
Prompt the user for input with echo enabled. The reply will be
- stored in the _\br_\be_\bp_\bl_\bi_\be_\bs array.
+ stored in the _\br_\be_\bp_\bl_\bi_\be_\bs array, and it will never be NULL.
SUDO_CONV_ERROR_MSG
Display an error message. The message is written to the standard
SUDO_CONV_PROMPT_MASK
Prompt the user for input but echo an asterisk character for each
- character read. The reply will be stored in the _\br_\be_\bp_\bl_\bi_\be_\bs This can
- be used to provide visual feedback to the user while reading
- sensitive information that should not be displayed.
+ character read. The reply will be stored in the _\br_\be_\bp_\bl_\bi_\be_\bs array, and
+ it will never be NULL. This can be used to provide visual feedback
+ to the user while reading sensitive information that should not be
+ displayed.
In addition to the above values, the following flag bits may also be set:
used for output. SUDO_CONV_ERROR_MSG or SUDO_CONV_INFO_MSG was
used.
+ The _\bt_\bi_\bm_\be_\bo_\bu_\bt in seconds until the prompt will wait for no more input. A
+ zero value implies an infinite timeout.
+
The plugin is responsible for freeing the reply buffer located in each
struct sudo_conv_reply, if it is not NULL. SUDO_CONV_REPL_MAX represents
the maximum length of the reply buffer (not including the trailing NUL
file distributed with s\bsu\bud\bdo\bo or https://www.sudo.ws/license.html for
complete details.
-Sudo 1.8.26 October 7, 2018 Sudo 1.8.26
+Sudo 1.8.26 October 24, 2018 Sudo 1.8.26
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.TH "SUDO_PLUGIN" "5" "October 7, 2018" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
+.TH "SUDO_PLUGIN" "5" "October 24, 2018" "Sudo @PACKAGE_VERSION@" "File Formats Manual"
.nh
.if n .ad l
.SH "NAME"
function using
\fRSUDO_CONV_INFO_MSG\fR.
If the user requests detailed version information, the verbose flag will be set.
+.sp
+Returns 1 on success, 0 on failure, \-1 if a general error occurred,
+or \-2 if there was a usage error, although the return value is currently
+ignored.
.RE
.TP 6n
check_policy
.nf
.RS 6n
-int (*check_policy)(int argc, char * const argv[]
+int (*check_policy)(int argc, char * const argv[],
char *env_add[], char **command_info[],
char **argv_out[], char **user_env_out[]);
.RE
list
.nf
.RS 6n
-int (*list)(int verbose, const char *list_user,
- int argc, char * const argv[]);
+int (*list)(int argc, char * const argv[],
+ int verbose, const char *list_user);
.RE
.fi
.RS 6n
.RS 0n
/* Plugin API version major/minor. */
#define SUDO_API_VERSION_MAJOR 1
-#define SUDO_API_VERSION_MINOR 2
+#define SUDO_API_VERSION_MINOR 13
#define SUDO_API_MKVERSION(x, y) ((x << 16) | y)
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR,\e
SUDO_API_VERSION_MINOR)
.RS 6n
int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[],
- char * const user_info[], int argc, char * const argv[],
- char * const user_env[], char * const plugin_options[]);
+ char * const user_info[], char * const command_info[],
+ int argc, char * const argv[], char * const user_env[],
+ char * const plugin_options[]);
.RE
.fi
.RS 6n
\fBlog_stdin\fR(),
\fBlog_stdout\fR(),
\fBlog_stderr\fR(),
+\fBlog_suspend\fR(),
+\fBchange_winsize\fR(),
or
\fBshow_version\fR()
functions are called.
not counting the final
\fRNULL\fR
pointer.
+It can be zero, when
+\fBsudo\fR
+is called with
+\fB\-V\fR.
.TP 6n
argv
If
function using
\fRSUDO_CONV_INFO_MSG\fR.
If the user requests detailed version information, the verbose flag will be set.
+.sp
+Returns 1 on success, 0 on failure, \-1 if a general error occurred,
+or \-2 if there was a usage error, although the return value is currently
+ignored.
.RE
.TP 6n
log_ttyin
and
\fRstruct sudo_conv_reply\fR
for
-each message in the conversation.
+each message in the conversation, that is, both arrays must have the same
+number of elements.
+Each
+\fRstruct sudo_conv_reply\fR
+must have its
+\fIreply\fR
+member initialized to
+\fRNULL\fR.
The
\fRstruct sudo_conv_callback\fR
pointer, if not
this is generally used for passwords.
The reply will be stored in the
\fIreplies\fR
-array.
+array, and it will never be
+\fRNULL\fR.
.TP 6n
SUDO_CONV_PROMPT_ECHO_ON
Prompt the user for input with echo enabled.
The reply will be stored in the
\fIreplies\fR
-array.
+array, and it will never be
+\fRNULL\fR.
.TP 6n
SUDO_CONV_ERROR_MSG
Display an error message.
character read.
The reply will be stored in the
\fIreplies\fR
+array, and it will never be
+\fRNULL\fR.
This can be used to provide visual feedback to the user while reading
sensitive information that should not be displayed.
.PP
\fRSUDO_CONV_INFO_MSG\fR
was used.
.PP
+The
+\fItimeout\fR
+in seconds until the prompt will wait for no more input.
+A zero value implies an infinite timeout.
+.PP
The plugin is responsible for freeing the reply buffer located in each
\fRstruct sudo_conv_reply\fR,
if it is not
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd October 7, 2018
+.Dd October 24, 2018
.Dt SUDO_PLUGIN @mansectform@
.Os Sudo @PACKAGE_VERSION@
.Sh NAME
function using
.Dv SUDO_CONV_INFO_MSG .
If the user requests detailed version information, the verbose flag will be set.
+.Pp
+Returns 1 on success, 0 on failure, \-1 if a general error occurred,
+or \-2 if there was a usage error, although the return value is currently
+ignored.
.It check_policy
.Bd -literal -compact
-int (*check_policy)(int argc, char * const argv[]
+int (*check_policy)(int argc, char * const argv[],
char *env_add[], char **command_info[],
char **argv_out[], char **user_env_out[]);
.Ed
.El
.It list
.Bd -literal -compact
-int (*list)(int verbose, const char *list_user,
- int argc, char * const argv[]);
+int (*list)(int argc, char * const argv[],
+ int verbose, const char *list_user);
.Ed
.Pp
List available privileges for the invoking user.
.Bd -literal
/* Plugin API version major/minor. */
#define SUDO_API_VERSION_MAJOR 1
-#define SUDO_API_VERSION_MINOR 2
+#define SUDO_API_VERSION_MINOR 13
#define SUDO_API_MKVERSION(x, y) ((x << 16) | y)
#define SUDO_API_VERSION SUDO_API_MKVERSION(SUDO_API_VERSION_MAJOR,\e
SUDO_API_VERSION_MINOR)
.Bd -literal -compact
int (*open)(unsigned int version, sudo_conv_t conversation,
sudo_printf_t plugin_printf, char * const settings[],
- char * const user_info[], int argc, char * const argv[],
- char * const user_env[], char * const plugin_options[]);
+ char * const user_info[], char * const command_info[],
+ int argc, char * const argv[], char * const user_env[],
+ char * const plugin_options[]);
.Ed
.Pp
The
.Fn log_stdin ,
.Fn log_stdout ,
.Fn log_stderr ,
+.Fn log_suspend ,
+.Fn change_winsize ,
or
.Fn show_version
functions are called.
not counting the final
.Dv NULL
pointer.
+It can be zero, when
+.Nm sudo
+is called with
+.Fl V .
.It argv
If
.No non- Ns Dv NULL ,
function using
.Dv SUDO_CONV_INFO_MSG .
If the user requests detailed version information, the verbose flag will be set.
+.Pp
+Returns 1 on success, 0 on failure, \-1 if a general error occurred,
+or \-2 if there was a usage error, although the return value is currently
+ignored.
.It log_ttyin
.Bd -literal -compact
int (*log_ttyin)(const char *buf, unsigned int len);
and
.Li struct sudo_conv_reply
for
-each message in the conversation.
+each message in the conversation, that is, both arrays must have the same
+number of elements.
+Each
+.Li struct sudo_conv_reply
+must have its
+.Em reply
+member initialized to
+.Dv NULL .
The
.Li struct sudo_conv_callback
pointer, if not
this is generally used for passwords.
The reply will be stored in the
.Em replies
-array.
+array, and it will never be
+.Dv NULL .
.It SUDO_CONV_PROMPT_ECHO_ON
Prompt the user for input with echo enabled.
The reply will be stored in the
.Em replies
-array.
+array, and it will never be
+.Dv NULL .
.It SUDO_CONV_ERROR_MSG
Display an error message.
The message is written to the standard error unless the
character read.
The reply will be stored in the
.Em replies
+array, and it will never be
+.Dv NULL .
This can be used to provide visual feedback to the user while reading
sensitive information that should not be displayed.
.El
was used.
.El
.Pp
+The
+.Em timeout
+in seconds until the prompt will wait for no more input.
+A zero value implies an infinite timeout.
+.Pp
The plugin is responsible for freeing the reply buffer located in each
.Li struct sudo_conv_reply ,
if it is not