2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 09:57:41 +00:00

Move the init_session() errstr description to where it belongs.

This commit is contained in:
Todd C. Miller 2022-09-11 19:06:23 -06:00
parent b85f95cb30
commit 3f6ffead0b
2 changed files with 92 additions and 95 deletions

View File

@ -1824,21 +1824,28 @@ function can be
used to tear down the session that was opened by used to tear down the session that was opened by
\fRinit_session\fR. \fRinit_session\fR.
.sp .sp
The Returns 1 on success, 0 on failure, and \-1 on error.
\fIpwd\fR On error, the plugin may optionally call the
argument points to a passwd struct for the user the \fBconversation\fR()
command will be run as if the user-ID the command will run as was found or
in the password database, otherwise it will be \fBplugin_printf\fR()
\fRNULL\fR. function with
\fRSUDO_CONF_ERROR_MSG\fR
to present additional
error information to the user.
.sp .sp
The function arguments are as follows:
.TP 6n
pwd
If the user-ID the command will run as was found in the password database,
\fIpwd\fR
will describe that user, otherwise it will be
\fRNULL\fR.
.TP 6n
user_env_out
The The
\fIuser_env_out\fR
argument points to the environment the command will
run in, in the form of a
\fRNULL\fR-terminated \fRNULL\fR-terminated
vector of environment vector to use when executing the command.
\(lqname=value\(rq
strings.
This is the same string passed back to the front-end via This is the same string passed back to the front-end via
the Policy Plugin's the Policy Plugin's
\fIuser_env_out\fR \fIuser_env_out\fR
@ -1863,17 +1870,37 @@ version specified by the
front-end before using front-end before using
\fIuser_env_out\fR. \fIuser_env_out\fR.
Failure to do so may result in a crash. Failure to do so may result in a crash.
.TP 6n
errstr
If the
\fBinit_session\fR()
function returns a value other than 1, the plugin may
store a message describing the failure or error in
\fIerrstr\fR.
The
\fBsudo\fR
front-end will then pass this value to any registered audit plugins.
The string stored in
\fIerrstr\fR
must remain valid until the plugin's
\fBclose\fR()
function is called.
.sp .sp
Returns 1 on success, 0 on failure, and \-1 on error. The
On error, the plugin may optionally call the \fIerrstr\fR
\fBconversation\fR() parameter is only available starting with
or API version 1.15.
\fBplugin_printf\fR() A plugin
function with \fBmust\fR
\fRSUDO_CONF_ERROR_MSG\fR check the API version specified by the
to present additional \fBsudo\fR
error information to the user. front-end before using
\fIerrstr\fR.
Failure to do so may result in a crash.
.PD 0
.PP
.RE .RE
.PD
.TP 6n .TP 6n
register_hooks register_hooks
.nf .nf
@ -2017,33 +2044,6 @@ version 1.15 or higher,
\fBevent_alloc\fR() \fBevent_alloc\fR()
will not be set. will not be set.
.RE .RE
.TP 6n
errstr
If the
\fBinit_session\fR()
function returns a value other than 1, the plugin may
store a message describing the failure or error in
\fIerrstr\fR.
The
\fBsudo\fR
front-end will then pass this value to any registered audit plugins.
The string stored in
\fIerrstr\fR
must remain valid until the plugin's
\fBclose\fR()
function is called.
.sp
The
\fIerrstr\fR
parameter is only available starting with
API version 1.15.
A plugin
\fBmust\fR
check the API version specified by the
\fBsudo\fR
front-end before using
\fIerrstr\fR.
Failure to do so may result in a crash.
.PP .PP
\fIPolicy Plugin Version Macros\fR \fIPolicy Plugin Version Macros\fR
.nf .nf

View File

@ -1630,21 +1630,27 @@ function can be
used to tear down the session that was opened by used to tear down the session that was opened by
.Li init_session . .Li init_session .
.Pp .Pp
The Returns 1 on success, 0 on failure, and \-1 on error.
.Em pwd On error, the plugin may optionally call the
argument points to a passwd struct for the user the .Fn conversation
command will be run as if the user-ID the command will run as was found or
in the password database, otherwise it will be .Fn plugin_printf
.Dv NULL . function with
.Dv SUDO_CONF_ERROR_MSG
to present additional
error information to the user.
.Pp .Pp
The function arguments are as follows:
.Bl -tag -width 4n
.It pwd
If the user-ID the command will run as was found in the password database,
.Fa pwd
will describe that user, otherwise it will be
.Dv NULL .
.It user_env_out
The The
.Em user_env_out
argument points to the environment the command will
run in, in the form of a
.Dv NULL Ns -terminated .Dv NULL Ns -terminated
vector of environment vector to use when executing the command.
.Dq name=value
strings.
This is the same string passed back to the front-end via This is the same string passed back to the front-end via
the Policy Plugin's the Policy Plugin's
.Em user_env_out .Em user_env_out
@ -1669,16 +1675,33 @@ version specified by the
front-end before using front-end before using
.Em user_env_out . .Em user_env_out .
Failure to do so may result in a crash. Failure to do so may result in a crash.
.It errstr
If the
.Fn init_session
function returns a value other than 1, the plugin may
store a message describing the failure or error in
.Fa errstr .
The
.Nm sudo
front-end will then pass this value to any registered audit plugins.
The string stored in
.Fa errstr
must remain valid until the plugin's
.Fn close
function is called.
.Pp .Pp
Returns 1 on success, 0 on failure, and \-1 on error. The
On error, the plugin may optionally call the .Fa errstr
.Fn conversation parameter is only available starting with
or API version 1.15.
.Fn plugin_printf A plugin
function with .Sy must
.Dv SUDO_CONF_ERROR_MSG check the API version specified by the
to present additional .Nm sudo
error information to the user. front-end before using
.Fa errstr .
Failure to do so may result in a crash.
.El
.It register_hooks .It register_hooks
.Bd -literal -compact .Bd -literal -compact
void (*register_hooks)(int version, void (*register_hooks)(int version,
@ -1807,32 +1830,6 @@ front-end doesn't support API
version 1.15 or higher, version 1.15 or higher,
.Fn event_alloc .Fn event_alloc
will not be set. will not be set.
.It errstr
If the
.Fn init_session
function returns a value other than 1, the plugin may
store a message describing the failure or error in
.Fa errstr .
The
.Nm sudo
front-end will then pass this value to any registered audit plugins.
The string stored in
.Fa errstr
must remain valid until the plugin's
.Fn close
function is called.
.Pp
The
.Fa errstr
parameter is only available starting with
API version 1.15.
A plugin
.Sy must
check the API version specified by the
.Nm sudo
front-end before using
.Fa errstr .
Failure to do so may result in a crash.
.El .El
.Pp .Pp
.Em Policy Plugin Version Macros .Em Policy Plugin Version Macros