Add a "noninteractive" boolean to the settings passed in to the plugin's
open function that is set when the user specifies the -n flag.
This commit is contained in:
@@ -61,7 +61,7 @@ SSuuddoo PPlluuggiinn AAPPII
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 1
|
1.8.0a1 April 14, 2010 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -127,7 +127,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 2
|
1.8.0a1 April 14, 2010 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -193,7 +193,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 3
|
1.8.0a1 April 14, 2010 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -205,6 +205,12 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
command, indicating that the user wishes to ignore any
|
command, indicating that the user wishes to ignore any
|
||||||
cached authentication credentials.
|
cached authentication credentials.
|
||||||
|
|
||||||
|
noninteractive=bool
|
||||||
|
Set to true if the user specified the -n flag, indicating
|
||||||
|
that ssuuddoo should operate in non-interactive mode. The
|
||||||
|
plugin may reject a command run in non-interactive mode if
|
||||||
|
user interaction is required.
|
||||||
|
|
||||||
login_class=string
|
login_class=string
|
||||||
BSD login class to use when setting resource limits and
|
BSD login class to use when setting resource limits and
|
||||||
nice value, if specified by the -c flag.
|
nice value, if specified by the -c flag.
|
||||||
@@ -250,16 +256,10 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
The user's supplementary group list formatted as a string
|
The user's supplementary group list formatted as a string
|
||||||
of comma-separated group IDs.
|
of comma-separated group IDs.
|
||||||
|
|
||||||
cwd=string
|
|
||||||
The user's current working directory.
|
|
||||||
|
|
||||||
tty=string
|
|
||||||
The path to the user's terminal device. If the user has no
|
|
||||||
terminal device associated with the session, the value will
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 4
|
1.8.0a1 April 14, 2010 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -268,6 +268,12 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
||||||
|
|
||||||
|
|
||||||
|
cwd=string
|
||||||
|
The user's current working directory.
|
||||||
|
|
||||||
|
tty=string
|
||||||
|
The path to the user's terminal device. If the user has no
|
||||||
|
terminal device associated with the session, the value will
|
||||||
be empty, as in tty=.
|
be empty, as in tty=.
|
||||||
|
|
||||||
host=string
|
host=string
|
||||||
@@ -316,16 +322,10 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
int (*show_version)(int verbose);
|
int (*show_version)(int verbose);
|
||||||
|
|
||||||
The show_version function is called by ssuuddoo when the user specifies
|
The show_version function is called by ssuuddoo when the user specifies
|
||||||
the -V option. The plugin may display its version information to
|
|
||||||
the user via the conversation function using SUDO_CONV_INFO_MSG.
|
|
||||||
If the user requests detailed version information, the verbose flag
|
|
||||||
will be set.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.8.0a1 April 14, 2010 5
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 5
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -334,6 +334,11 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
||||||
|
|
||||||
|
|
||||||
|
the -V option. The plugin may display its version information to
|
||||||
|
the user via the conversation function using SUDO_CONV_INFO_MSG.
|
||||||
|
If the user requests detailed version information, the verbose flag
|
||||||
|
will be set.
|
||||||
|
|
||||||
check_policy
|
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 *env_add[], char **command_info[],
|
||||||
@@ -383,15 +388,10 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
runas_uid=uid
|
runas_uid=uid
|
||||||
User ID to run the command as.
|
User ID to run the command as.
|
||||||
|
|
||||||
runas_euid=uid
|
|
||||||
Effective user ID to run the command as. If not specified,
|
|
||||||
the value of _r_u_n_a_s___u_i_d is used.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.8.0a1 April 14, 2010 6
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 6
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -400,6 +400,10 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
||||||
|
|
||||||
|
|
||||||
|
runas_euid=uid
|
||||||
|
Effective user ID to run the command as. If not specified,
|
||||||
|
the value of _r_u_n_a_s___u_i_d is used.
|
||||||
|
|
||||||
runas_gid=gid
|
runas_gid=gid
|
||||||
Group ID to run the command as.
|
Group ID to run the command as.
|
||||||
|
|
||||||
@@ -451,13 +455,9 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
Unsupported values will be ignored.
|
Unsupported values will be ignored.
|
||||||
|
|
||||||
argv_out
|
|
||||||
The NULL-terminated argument vector to pass to the _e_x_e_c_v_e_(_)
|
|
||||||
system call when executing the command. The plugin is
|
|
||||||
|
|
||||||
|
|
||||||
|
1.8.0a1 April 14, 2010 7
|
||||||
1.8.0a1 April 13, 2010 7
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -466,6 +466,9 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
||||||
|
|
||||||
|
|
||||||
|
argv_out
|
||||||
|
The NULL-terminated argument vector to pass to the _e_x_e_c_v_e_(_)
|
||||||
|
system call when executing the command. The plugin is
|
||||||
responsible for allocating and populating the vector.
|
responsible for allocating and populating the vector.
|
||||||
|
|
||||||
user_env_out
|
user_env_out
|
||||||
@@ -517,13 +520,10 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
Returns 1 on success, 0 on failure and -1 on error. On error, the
|
Returns 1 on success, 0 on failure and -1 on error. On error, the
|
||||||
plugin may optionally call the conversation function with
|
plugin may optionally call the conversation function with
|
||||||
SUDO_CONF_ERROR_MSG to present additional error information to the
|
|
||||||
user.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.8.0a1 April 14, 2010 8
|
||||||
1.8.0a1 April 13, 2010 8
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -532,6 +532,9 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
||||||
|
|
||||||
|
|
||||||
|
SUDO_CONF_ERROR_MSG to present additional error information to the
|
||||||
|
user.
|
||||||
|
|
||||||
invalidate
|
invalidate
|
||||||
void (*invalidate)(int remove);
|
void (*invalidate)(int remove);
|
||||||
|
|
||||||
@@ -586,10 +589,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1.8.0a1 April 14, 2010 9
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 9
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 10
|
1.8.0a1 April 14, 2010 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -721,7 +721,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 11
|
1.8.0a1 April 14, 2010 11
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -787,7 +787,7 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 12
|
1.8.0a1 April 14, 2010 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -853,6 +853,6 @@ SUDO_PLUGIN(1m) MAINTENANCE COMMANDS SUDO_PLUGIN(1m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
1.8.0a1 April 13, 2010 13
|
1.8.0a1 April 14, 2010 13
|
||||||
|
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@
|
|||||||
.\" ========================================================================
|
.\" ========================================================================
|
||||||
.\"
|
.\"
|
||||||
.IX Title "SUDO_PLUGIN @mansectsu@"
|
.IX Title "SUDO_PLUGIN @mansectsu@"
|
||||||
.TH SUDO_PLUGIN @mansectsu@ "April 13, 2010" "1.8.0a1" "MAINTENANCE COMMANDS"
|
.TH SUDO_PLUGIN @mansectsu@ "April 14, 2010" "1.8.0a1" "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
|
||||||
@@ -316,6 +316,12 @@ based on the runas user.
|
|||||||
Set to true if the user specified the \f(CW\*(C`\-k\*(C'\fR flag along with a
|
Set to true if the user specified the \f(CW\*(C`\-k\*(C'\fR flag along with a
|
||||||
command, indicating that the user wishes to ignore any cached
|
command, indicating that the user wishes to ignore any cached
|
||||||
authentication credentials.
|
authentication credentials.
|
||||||
|
.IP "noninteractive=bool" 4
|
||||||
|
.IX Item "noninteractive=bool"
|
||||||
|
Set to true if the user specified the \f(CW\*(C`\-n\*(C'\fR flag, indicating that
|
||||||
|
\&\fBsudo\fR should operate in non-interactive mode. The plugin may
|
||||||
|
reject a command run in non-interactive mode if user interaction
|
||||||
|
is required.
|
||||||
.IP "login_class=string" 4
|
.IP "login_class=string" 4
|
||||||
.IX Item "login_class=string"
|
.IX Item "login_class=string"
|
||||||
\&\s-1BSD\s0 login class to use when setting resource limits and nice value,
|
\&\s-1BSD\s0 login class to use when setting resource limits and nice value,
|
||||||
|
@@ -204,6 +204,13 @@ Set to true if the user specified the C<-k> flag along with a
|
|||||||
command, indicating that the user wishes to ignore any cached
|
command, indicating that the user wishes to ignore any cached
|
||||||
authentication credentials.
|
authentication credentials.
|
||||||
|
|
||||||
|
=item noninteractive=bool
|
||||||
|
|
||||||
|
Set to true if the user specified the C<-n> flag, indicating that
|
||||||
|
B<sudo> should operate in non-interactive mode. The plugin may
|
||||||
|
reject a command run in non-interactive mode if user interaction
|
||||||
|
is required.
|
||||||
|
|
||||||
=item login_class=string
|
=item login_class=string
|
||||||
|
|
||||||
BSD login class to use when setting resource limits and nice value,
|
BSD login class to use when setting resource limits and nice value,
|
||||||
|
@@ -105,7 +105,9 @@ static struct sudo_settings {
|
|||||||
{ "implied_shell" },
|
{ "implied_shell" },
|
||||||
#define ARG_PRESERVE_GROUPS 14
|
#define ARG_PRESERVE_GROUPS 14
|
||||||
{ "preserve_groups" },
|
{ "preserve_groups" },
|
||||||
#define NUM_SETTINGS 15
|
#define ARG_NONINTERACTIVE 15
|
||||||
|
{ "noninteractive" },
|
||||||
|
#define NUM_SETTINGS 16
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -235,6 +237,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
|
|||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
SET(flags, MODE_NONINTERACTIVE);
|
SET(flags, MODE_NONINTERACTIVE);
|
||||||
|
sudo_settings[ARG_NONINTERACTIVE].value = "true";
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case 'P':
|
||||||
sudo_settings[ARG_PRESERVE_GROUPS].value = "true";
|
sudo_settings[ARG_PRESERVE_GROUPS].value = "true";
|
||||||
|
Reference in New Issue
Block a user