doc/sudo_plugin_python: update python manual for constant -> enum changes
This commit is contained in:

committed by
Todd C. Miller

parent
1a1cb54975
commit
8f79d5c1c7
@@ -100,15 +100,15 @@ l l.
|
|||||||
.PP
|
.PP
|
||||||
\fBDefine\fR \fBValue\fR
|
\fBDefine\fR \fBValue\fR
|
||||||
.PP
|
.PP
|
||||||
\fRsudo.RC_OK\fR 1
|
\fRsudo.RC.OK\fR 1
|
||||||
.PP
|
.PP
|
||||||
\fRsudo.RC_ACCEPT\fR 1
|
\fRsudo.RC.ACCEPT\fR 1
|
||||||
.PP
|
.PP
|
||||||
\fRsudo.RC_REJECT\fR 0
|
\fRsudo.RC.REJECT\fR 0
|
||||||
.PP
|
.PP
|
||||||
\fRsudo.RC_ERROR\fR -1
|
\fRsudo.RC.ERROR\fR -1
|
||||||
.PP
|
.PP
|
||||||
\fRsudo.RC_USAGE_ERROR\fR -2
|
\fRsudo.RC.USAGE_ERROR\fR -2
|
||||||
.TE
|
.TE
|
||||||
.RE
|
.RE
|
||||||
.PP
|
.PP
|
||||||
@@ -116,10 +116,10 @@ If a function returns
|
|||||||
\fINone\fR
|
\fINone\fR
|
||||||
(for example, if it does not call return),
|
(for example, if it does not call return),
|
||||||
it will be considered to have returned
|
it will be considered to have returned
|
||||||
\fRsudo.RC_OK\fR.
|
\fRsudo.RC.OK\fR.
|
||||||
If an exception is raised, the backtrace will be shown to the user and
|
If an exception is raised, the backtrace will be shown to the user and
|
||||||
the plugin function will return
|
the plugin function will return
|
||||||
\fRsudo.RC_ERROR\fR.
|
\fRsudo.RC.ERROR\fR.
|
||||||
If that is not acceptable, you must catch the exception and handle it yourself.
|
If that is not acceptable, you must catch the exception and handle it yourself.
|
||||||
.SS "Python Plugin Loader"
|
.SS "Python Plugin Loader"
|
||||||
Running the Python interpreter and bridging between C and Python is
|
Running the Python interpreter and bridging between C and Python is
|
||||||
@@ -276,15 +276,15 @@ The tuple values are as follows:
|
|||||||
.TP 6n
|
.TP 6n
|
||||||
\fIrc\fR
|
\fIrc\fR
|
||||||
The result of the policy check, one of the
|
The result of the policy check, one of the
|
||||||
\fRsudo.RC_*\fR
|
\fRsudo.RC.*\fR
|
||||||
constants.
|
constants.
|
||||||
\fRsudo.RC_ACCEPT\fR
|
\fRsudo.RC.ACCEPT\fR
|
||||||
if the command is allowed,
|
if the command is allowed,
|
||||||
\fRsudo.RC_REJECT\fR
|
\fRsudo.RC.REJECT\fR
|
||||||
if not allowed,
|
if not allowed,
|
||||||
\fRsudo.RC_ERROR\fR
|
\fRsudo.RC.ERROR\fR
|
||||||
for a general error, or
|
for a general error, or
|
||||||
\fRsudo.RC_USAGE_ERROR\fR
|
\fRsudo.RC.USAGE_ERROR\fR
|
||||||
for a usage error.
|
for a usage error.
|
||||||
.TP 6n
|
.TP 6n
|
||||||
\fIcommand_info_out\fR
|
\fIcommand_info_out\fR
|
||||||
@@ -372,11 +372,11 @@ The tuple values are as follows:
|
|||||||
.TP 6n
|
.TP 6n
|
||||||
\fIrc\fR
|
\fIrc\fR
|
||||||
The result of the session init, one of the
|
The result of the session init, one of the
|
||||||
\fRsudo.RC_*\fR
|
\fRsudo.RC.*\fR
|
||||||
constants.
|
constants.
|
||||||
\fRsudo.RC_OK\fR
|
\fRsudo.RC.OK\fR
|
||||||
on success, 0 on failure, or
|
on success, 0 on failure, or
|
||||||
\fRsudo.RC_ERROR\fR
|
\fRsudo.RC.ERROR\fR
|
||||||
if an error occurred.
|
if an error occurred.
|
||||||
.TP 6n
|
.TP 6n
|
||||||
\fIuser_env_out\fR
|
\fIuser_env_out\fR
|
||||||
@@ -577,7 +577,7 @@ settings in the form of
|
|||||||
strings.
|
strings.
|
||||||
.TP 6n
|
.TP 6n
|
||||||
\fIversion\fR
|
\fIversion\fR
|
||||||
The version of the Python Policy Plugin API.
|
The version of the Python I/O Plugin API.
|
||||||
.TP 6n
|
.TP 6n
|
||||||
\fIuser_info\fR
|
\fIuser_info\fR
|
||||||
A tuple of information about the user running the command in the form of
|
A tuple of information about the user running the command in the form of
|
||||||
@@ -657,10 +657,10 @@ sudo_plugin(@mansectform@).
|
|||||||
The
|
The
|
||||||
\fBopen\fR()
|
\fBopen\fR()
|
||||||
function should return a result code, one of the
|
function should return a result code, one of the
|
||||||
\fRsudo.RC_*\fR
|
\fRsudo.RC.*\fR
|
||||||
constants.
|
constants.
|
||||||
If the function returns
|
If the function returns
|
||||||
\fRsudo.REJECT\fR,
|
\fRsudo.RC.REJECT\fR,
|
||||||
no I/O will be sent to the plugin.
|
no I/O will be sent to the plugin.
|
||||||
.RE
|
.RE
|
||||||
.TP 6n
|
.TP 6n
|
||||||
@@ -687,22 +687,22 @@ The function arguments are as follows:
|
|||||||
The input (or output) buffer in the form of a string.
|
The input (or output) buffer in the form of a string.
|
||||||
.PP
|
.PP
|
||||||
The function should return a result code, one of the
|
The function should return a result code, one of the
|
||||||
\fRsudo.RC_*\fR
|
\fRsudo.RC.*\fR
|
||||||
constants.
|
constants.
|
||||||
.sp
|
.sp
|
||||||
If
|
If
|
||||||
\fRsudo.RC_ERROR\fR
|
\fRsudo.RC.ERROR\fR
|
||||||
is returned, the running command will be terminated and all of the plugin's logging
|
is returned, the running command will be terminated and all of the plugin's logging
|
||||||
functions will be disabled.
|
functions will be disabled.
|
||||||
Other I/O logging plugins will still receive any remaining
|
Other I/O logging plugins will still receive any remaining
|
||||||
input or output that has not yet been processed.
|
input or output that has not yet been processed.
|
||||||
.sp
|
.sp
|
||||||
If an input logging function rejects the data by returning
|
If an input logging function rejects the data by returning
|
||||||
\fRsudo.RC_REJECT\fR,
|
\fRsudo.RC.REJECT\fR,
|
||||||
the command will be terminated and the data will not be passed to the
|
the command will be terminated and the data will not be passed to the
|
||||||
command, though it will still be sent to any other I/O logging plugins.
|
command, though it will still be sent to any other I/O logging plugins.
|
||||||
If an output logging function rejects the data by returning
|
If an output logging function rejects the data by returning
|
||||||
\fRsudo.RC_REJECT\fR,
|
\fRsudo.RC.REJECT\fR,
|
||||||
the command will be terminated and the data will not be written to the
|
the command will be terminated and the data will not be written to the
|
||||||
terminal, though it will still be sent to any other I/O logging plugins.
|
terminal, though it will still be sent to any other I/O logging plugins.
|
||||||
.RE
|
.RE
|
||||||
@@ -964,7 +964,7 @@ member variables:
|
|||||||
\fImsg_type\fR
|
\fImsg_type\fR
|
||||||
Specifies the type of the conversation.
|
Specifies the type of the conversation.
|
||||||
See the
|
See the
|
||||||
\fRsudo.CONV_*\fR
|
\fRsudo.CONV.*\fR
|
||||||
constants below.
|
constants below.
|
||||||
.TP 6n
|
.TP 6n
|
||||||
\fImsg\fR
|
\fImsg\fR
|
||||||
@@ -989,25 +989,25 @@ To specify the message type, the following constants are available:
|
|||||||
.PD 0
|
.PD 0
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_PROMPT_ECHO_OFF
|
sudo.CONV.PROMPT_ECHO_OFF
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_PROMPT_ECHO_ON
|
sudo.CONV.PROMPT_ECHO_ON
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_ERROR_MSG
|
sudo.CONV.ERROR_MSG
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_INFO_MSG
|
sudo.CONV.INFO_MSG
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_PROMPT_MASK
|
sudo.CONV.PROMPT_MASK
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_PROMPT_ECHO_OK
|
sudo.CONV.PROMPT_ECHO_OK
|
||||||
.TP 3n
|
.TP 3n
|
||||||
\fB\(bu\fR
|
\fB\(bu\fR
|
||||||
sudo.CONV_PREFER_TTY
|
sudo.CONV.PREFER_TTY
|
||||||
.RE
|
.RE
|
||||||
.PD
|
.PD
|
||||||
.PP
|
.PP
|
||||||
@@ -1206,21 +1206,21 @@ l l l.
|
|||||||
.PP
|
.PP
|
||||||
\fBsudo.conf name\fR \fBPython constant\fR \fBdescription\fR
|
\fBsudo.conf name\fR \fBPython constant\fR \fBdescription\fR
|
||||||
.PP
|
.PP
|
||||||
crit sudo.DEBUG_CRIT only cricital messages
|
crit sudo.DEBUG.CRIT only cricital messages
|
||||||
.PP
|
.PP
|
||||||
err sudo.DEBUG_ERROR
|
err sudo.DEBUG.ERROR
|
||||||
.PP
|
.PP
|
||||||
warn sudo.DEBUG_WARN
|
warn sudo.DEBUG.WARN
|
||||||
.PP
|
.PP
|
||||||
notice sudo.DEBUG_NOTICE
|
notice sudo.DEBUG.NOTICE
|
||||||
.PP
|
.PP
|
||||||
diag sudo.DEBUG_DIAG
|
diag sudo.DEBUG.DIAG
|
||||||
.PP
|
.PP
|
||||||
info sudo.DEBUG_INFO
|
info sudo.DEBUG.INFO
|
||||||
.PP
|
.PP
|
||||||
trace sudo.DEBUG_TRACE
|
trace sudo.DEBUG.TRACE
|
||||||
.PP
|
.PP
|
||||||
debug sudo.DEBUG_DEBUG very extreme verbose debugging
|
debug sudo.DEBUG.DEBUG very extreme verbose debugging
|
||||||
.TE
|
.TE
|
||||||
.SS "Debug example"
|
.SS "Debug example"
|
||||||
Sudo ships an example debug plugin by default.
|
Sudo ships an example debug plugin by default.
|
||||||
|
@@ -85,23 +85,23 @@ result code, as documented in
|
|||||||
.Xr sudo_plugin @mansctsu@ ,
|
.Xr sudo_plugin @mansctsu@ ,
|
||||||
that indicates whether or not the method was successful.
|
that indicates whether or not the method was successful.
|
||||||
The Python sudo module defines the following constants to improve readability:
|
The Python sudo module defines the following constants to improve readability:
|
||||||
.Bl -column "sudo.RC_USAGE_ERROR" "XXX" -offset 4n
|
.Bl -column "sudo.RC.USAGE_ERROR" "XXX" -offset 4n
|
||||||
.It Sy Define Ta Sy Value
|
.It Sy Define Ta Sy Value
|
||||||
.It Dv sudo.RC_OK Ta 1
|
.It Dv sudo.RC.OK Ta 1
|
||||||
.It Dv sudo.RC_ACCEPT Ta 1
|
.It Dv sudo.RC.ACCEPT Ta 1
|
||||||
.It Dv sudo.RC_REJECT Ta 0
|
.It Dv sudo.RC.REJECT Ta 0
|
||||||
.It Dv sudo.RC_ERROR Ta -1
|
.It Dv sudo.RC.ERROR Ta -1
|
||||||
.It Dv sudo.RC_USAGE_ERROR Ta -2
|
.It Dv sudo.RC.USAGE_ERROR Ta -2
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
If a function returns
|
If a function returns
|
||||||
.Em None
|
.Em None
|
||||||
(for example, if it does not call return),
|
(for example, if it does not call return),
|
||||||
it will be considered to have returned
|
it will be considered to have returned
|
||||||
.Dv sudo.RC_OK .
|
.Dv sudo.RC.OK .
|
||||||
If an exception is raised, the backtrace will be shown to the user and
|
If an exception is raised, the backtrace will be shown to the user and
|
||||||
the plugin function will return
|
the plugin function will return
|
||||||
.Dv sudo.RC_ERROR .
|
.Dv sudo.RC.ERROR .
|
||||||
If that is not acceptable, you must catch the exception and handle it yourself.
|
If that is not acceptable, you must catch the exception and handle it yourself.
|
||||||
.Ss Python Plugin Loader
|
.Ss Python Plugin Loader
|
||||||
Running the Python interpreter and bridging between C and Python is
|
Running the Python interpreter and bridging between C and Python is
|
||||||
@@ -235,15 +235,15 @@ The tuple values are as follows:
|
|||||||
.Bl -tag -width 4n
|
.Bl -tag -width 4n
|
||||||
.It Fa rc
|
.It Fa rc
|
||||||
The result of the policy check, one of the
|
The result of the policy check, one of the
|
||||||
.Dv sudo.RC_*
|
.Dv sudo.RC.*
|
||||||
constants.
|
constants.
|
||||||
.Dv sudo.RC_ACCEPT
|
.Dv sudo.RC.ACCEPT
|
||||||
if the command is allowed,
|
if the command is allowed,
|
||||||
.Dv sudo.RC_REJECT
|
.Dv sudo.RC.REJECT
|
||||||
if not allowed,
|
if not allowed,
|
||||||
.Dv sudo.RC_ERROR
|
.Dv sudo.RC.ERROR
|
||||||
for a general error, or
|
for a general error, or
|
||||||
.Dv sudo.RC_USAGE_ERROR
|
.Dv sudo.RC.USAGE_ERROR
|
||||||
for a usage error.
|
for a usage error.
|
||||||
.It Fa command_info_out
|
.It Fa command_info_out
|
||||||
Optional (only required when the command is accepted).
|
Optional (only required when the command is accepted).
|
||||||
@@ -316,11 +316,11 @@ The tuple values are as follows:
|
|||||||
.Bl -tag -width 4n
|
.Bl -tag -width 4n
|
||||||
.It Fa rc
|
.It Fa rc
|
||||||
The result of the session init, one of the
|
The result of the session init, one of the
|
||||||
.Dv sudo.RC_*
|
.Dv sudo.RC.*
|
||||||
constants.
|
constants.
|
||||||
.Dv sudo.RC_OK
|
.Dv sudo.RC.OK
|
||||||
on success, 0 on failure, or
|
on success, 0 on failure, or
|
||||||
.Dv sudo.RC_ERROR
|
.Dv sudo.RC.ERROR
|
||||||
if an error occurred.
|
if an error occurred.
|
||||||
.It Fa user_env_out
|
.It Fa user_env_out
|
||||||
Optional.
|
Optional.
|
||||||
@@ -469,7 +469,7 @@ settings in the form of
|
|||||||
.Dq key=value
|
.Dq key=value
|
||||||
strings.
|
strings.
|
||||||
.It Fa version
|
.It Fa version
|
||||||
The version of the Python Policy Plugin API.
|
The version of the Python I/O Plugin API.
|
||||||
.It Fa user_info
|
.It Fa user_info
|
||||||
A tuple of information about the user running the command in the form of
|
A tuple of information about the user running the command in the form of
|
||||||
.Dq key=value
|
.Dq key=value
|
||||||
@@ -539,10 +539,10 @@ documentation in
|
|||||||
The
|
The
|
||||||
.Fn open
|
.Fn open
|
||||||
function should return a result code, one of the
|
function should return a result code, one of the
|
||||||
.Dv sudo.RC_*
|
.Dv sudo.RC.*
|
||||||
constants.
|
constants.
|
||||||
If the function returns
|
If the function returns
|
||||||
.Dv sudo.REJECT ,
|
.Dv sudo.RC.REJECT ,
|
||||||
no I/O will be sent to the plugin.
|
no I/O will be sent to the plugin.
|
||||||
.It Sy log_ttyin , log_ttyout , log_stdin , log_stdout , log_stderr
|
.It Sy log_ttyin , log_ttyout , log_stdin , log_stdout , log_stderr
|
||||||
.Bd -literal -compact
|
.Bd -literal -compact
|
||||||
@@ -565,22 +565,22 @@ The input (or output) buffer in the form of a string.
|
|||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
The function should return a result code, one of the
|
The function should return a result code, one of the
|
||||||
.Dv sudo.RC_*
|
.Dv sudo.RC.*
|
||||||
constants.
|
constants.
|
||||||
.Pp
|
.Pp
|
||||||
If
|
If
|
||||||
.Dv sudo.RC_ERROR
|
.Dv sudo.RC.ERROR
|
||||||
is returned, the running command will be terminated and all of the plugin's logging
|
is returned, the running command will be terminated and all of the plugin's logging
|
||||||
functions will be disabled.
|
functions will be disabled.
|
||||||
Other I/O logging plugins will still receive any remaining
|
Other I/O logging plugins will still receive any remaining
|
||||||
input or output that has not yet been processed.
|
input or output that has not yet been processed.
|
||||||
.Pp
|
.Pp
|
||||||
If an input logging function rejects the data by returning
|
If an input logging function rejects the data by returning
|
||||||
.Dv sudo.RC_REJECT ,
|
.Dv sudo.RC.REJECT ,
|
||||||
the command will be terminated and the data will not be passed to the
|
the command will be terminated and the data will not be passed to the
|
||||||
command, though it will still be sent to any other I/O logging plugins.
|
command, though it will still be sent to any other I/O logging plugins.
|
||||||
If an output logging function rejects the data by returning
|
If an output logging function rejects the data by returning
|
||||||
.Dv sudo.RC_REJECT ,
|
.Dv sudo.RC.REJECT ,
|
||||||
the command will be terminated and the data will not be written to the
|
the command will be terminated and the data will not be written to the
|
||||||
terminal, though it will still be sent to any other I/O logging plugins.
|
terminal, though it will still be sent to any other I/O logging plugins.
|
||||||
.It Sy change_winsize
|
.It Sy change_winsize
|
||||||
@@ -780,7 +780,7 @@ member variables:
|
|||||||
.It Fa msg_type
|
.It Fa msg_type
|
||||||
Specifies the type of the conversation.
|
Specifies the type of the conversation.
|
||||||
See the
|
See the
|
||||||
.Dv sudo.CONV_*
|
.Dv sudo.CONV.*
|
||||||
constants below.
|
constants below.
|
||||||
.It Fa msg
|
.It Fa msg
|
||||||
The message to display to the user.
|
The message to display to the user.
|
||||||
@@ -802,19 +802,19 @@ To specify the message type, the following constants are available:
|
|||||||
.Pp
|
.Pp
|
||||||
.Bl -bullet -compact -offset 4n -width 1n
|
.Bl -bullet -compact -offset 4n -width 1n
|
||||||
.It
|
.It
|
||||||
sudo.CONV_PROMPT_ECHO_OFF
|
sudo.CONV.PROMPT_ECHO_OFF
|
||||||
.It
|
.It
|
||||||
sudo.CONV_PROMPT_ECHO_ON
|
sudo.CONV.PROMPT_ECHO_ON
|
||||||
.It
|
.It
|
||||||
sudo.CONV_ERROR_MSG
|
sudo.CONV.ERROR_MSG
|
||||||
.It
|
.It
|
||||||
sudo.CONV_INFO_MSG
|
sudo.CONV.INFO_MSG
|
||||||
.It
|
.It
|
||||||
sudo.CONV_PROMPT_MASK
|
sudo.CONV.PROMPT_MASK
|
||||||
.It
|
.It
|
||||||
sudo.CONV_PROMPT_ECHO_OK
|
sudo.CONV.PROMPT_ECHO_OK
|
||||||
.It
|
.It
|
||||||
sudo.CONV_PREFER_TTY
|
sudo.CONV.PREFER_TTY
|
||||||
.El
|
.El
|
||||||
.Pp
|
.Pp
|
||||||
See the
|
See the
|
||||||
@@ -985,14 +985,14 @@ one or more messages to log
|
|||||||
.Em Available log levels:
|
.Em Available log levels:
|
||||||
.Bl -column "name in sudo.conf" "Python constant" "only cricital messages"
|
.Bl -column "name in sudo.conf" "Python constant" "only cricital messages"
|
||||||
.It Sy sudo.conf name Ta Sy Python constant Ta Sy description
|
.It Sy sudo.conf name Ta Sy Python constant Ta Sy description
|
||||||
.It crit Ta sudo.DEBUG_CRIT Ta only cricital messages
|
.It crit Ta sudo.DEBUG.CRIT Ta only cricital messages
|
||||||
.It err Ta sudo.DEBUG_ERROR Ta
|
.It err Ta sudo.DEBUG.ERROR Ta
|
||||||
.It warn Ta sudo.DEBUG_WARN Ta
|
.It warn Ta sudo.DEBUG.WARN Ta
|
||||||
.It notice Ta sudo.DEBUG_NOTICE Ta
|
.It notice Ta sudo.DEBUG.NOTICE Ta
|
||||||
.It diag Ta sudo.DEBUG_DIAG Ta
|
.It diag Ta sudo.DEBUG.DIAG Ta
|
||||||
.It info Ta sudo.DEBUG_INFO Ta
|
.It info Ta sudo.DEBUG.INFO Ta
|
||||||
.It trace Ta sudo.DEBUG_TRACE Ta
|
.It trace Ta sudo.DEBUG.TRACE Ta
|
||||||
.It debug Ta sudo.DEBUG_DEBUG Ta very extreme verbose debugging
|
.It debug Ta sudo.DEBUG.DEBUG Ta very extreme verbose debugging
|
||||||
.El
|
.El
|
||||||
.Ss Debug example
|
.Ss Debug example
|
||||||
Sudo ships an example debug plugin by default.
|
Sudo ships an example debug plugin by default.
|
||||||
|
Reference in New Issue
Block a user