]> granicus.if.org Git - sudo/commitdiff
Add a "noninteractive" boolean to the settings passed in to the plugin's
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 14 Apr 2010 12:41:53 +0000 (08:41 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 14 Apr 2010 12:41:53 +0000 (08:41 -0400)
open function that is set when the user specifies the -n flag.

doc/sudo_plugin.cat
doc/sudo_plugin.man.in
doc/sudo_plugin.pod
src/parse_args.c

index d4ad795eaafe95185df04cb27368d4d34ceef34d..5a25cf69c4a4fff4f02d03f7c4a29805a808368b 100644 (file)
@@ -61,7 +61,7 @@ S\bSu\bud\bdo\bo P\bPl\blu\bug\bgi\bin\bn A\bAP\bPI\bI
 
 
 
-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
                    cached authentication credentials.
 
+               noninteractive=bool
+                   Set to true if the user specified the -n flag, indicating
+                   that s\bsu\bud\bdo\bo 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
                    BSD login class to use when setting resource limits and
                    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
                    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)
 
 
+               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=.
 
                host=string
@@ -316,16 +322,10 @@ SUDO_PLUGIN(1m)        MAINTENANCE COMMANDS       SUDO_PLUGIN(1m)
             int (*show_version)(int verbose);
 
            The show_version function is called by s\bsu\bud\bdo\bo 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 13, 2010                        5
+1.8.0a1                   April 14, 2010                        5
 
 
 
@@ -334,6 +334,11 @@ 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
             int (*check_policy)(int argc, char * const argv[]
                                 char *env_add[], char **command_info[],
@@ -383,15 +388,10 @@ SUDO_PLUGIN(1m)        MAINTENANCE COMMANDS       SUDO_PLUGIN(1m)
                runas_uid=uid
                    User ID to run the command as.
 
-               runas_euid=uid
-                   Effective user ID to run the command as.  If not specified,
-                   the value of _\br_\bu_\bn_\ba_\bs_\b__\bu_\bi_\bd is used.
-
 
 
 
-
-1.8.0a1                   April 13, 2010                        6
+1.8.0a1                   April 14, 2010                        6
 
 
 
@@ -400,6 +400,10 @@ 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 _\br_\bu_\bn_\ba_\bs_\b__\bu_\bi_\bd is used.
+
                runas_gid=gid
                    Group ID to run the command as.
 
@@ -451,13 +455,9 @@ SUDO_PLUGIN(1m)        MAINTENANCE COMMANDS       SUDO_PLUGIN(1m)
 
                Unsupported values will be ignored.
 
-           argv_out
-               The NULL-terminated argument vector to pass to the _\be_\bx_\be_\bc_\bv_\be_\b(_\b)
-               system call when executing the command.  The plugin is
-
 
 
-1.8.0a1                   April 13, 2010                        7
+1.8.0a1                   April 14, 2010                        7
 
 
 
@@ -466,6 +466,9 @@ 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 _\be_\bx_\be_\bc_\bv_\be_\b(_\b)
+               system call when executing the command.  The plugin is
                responsible for allocating and populating the vector.
 
            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
            plugin may optionally call the conversation function with
-           SUDO_CONF_ERROR_MSG to present additional error information to the
-           user.
-
 
 
 
-1.8.0a1                   April 13, 2010                        8
+1.8.0a1                   April 14, 2010                        8
 
 
 
@@ -532,6 +532,9 @@ 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
             void (*invalidate)(int remove);
 
@@ -586,10 +589,7 @@ SUDO_PLUGIN(1m)        MAINTENANCE COMMANDS       SUDO_PLUGIN(1m)
 
 
 
-
-
-
-1.8.0a1                   April 13, 2010                        9
+1.8.0a1                   April 14, 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
 
 
index 572dc89ef1ee0b02a91ccac0e5af044f6b56d6ed..11006f33c8052388f219ce8e5bbc7521036d4f34 100644 (file)
 .\" ========================================================================
 .\"
 .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
 .\" way too many mistakes in technical documents.
 .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
 command, indicating that the user wishes to ignore any cached
 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
 .IX Item "login_class=string"
 \&\s-1BSD\s0 login class to use when setting resource limits and nice value,
index 3282908e6c5d55af6baee7f24d6149d05dbe04a2..1bf0f7ae3d0193a5d53ee074d526bd5265a74bd0 100644 (file)
@@ -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
 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
 
 BSD login class to use when setting resource limits and nice value,
index 68c89a7ec51f7e60bbafec1feefbbdf57166fc45..ecf5a664f534d4f58e34ad617fe0a7cb57e1ec41 100644 (file)
@@ -105,7 +105,9 @@ static struct sudo_settings {
     { "implied_shell" },
 #define ARG_PRESERVE_GROUPS 14
     { "preserve_groups" },
-#define NUM_SETTINGS 15
+#define ARG_NONINTERACTIVE 15
+    { "noninteractive" },
+#define NUM_SETTINGS 16
     { NULL }
 };
 
@@ -235,6 +237,7 @@ parse_args(int argc, char **argv, int *nargc, char ***nargv, char ***settingsp,
                    break;
                case 'n':
                    SET(flags, MODE_NONINTERACTIVE);
+                   sudo_settings[ARG_NONINTERACTIVE].value = "true";
                    break;
                case 'P':
                    sudo_settings[ARG_PRESERVE_GROUPS].value = "true";