From 92199e25c4b8a69bab862c2bd2d46c840caa23b1 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 7 May 2020 11:11:43 -0600 Subject: [PATCH] The --preserve-env=list option may be specified more than once. --- doc/sudo.man.in | 6 ++++-- doc/sudo.mdoc.in | 6 ++++-- src/parse_args.c | 2 -- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/sudo.man.in b/doc/sudo.man.in index 1874dd6c4..fcefabdd4 100644 --- a/doc/sudo.man.in +++ b/doc/sudo.man.in @@ -25,7 +25,7 @@ .nr BA @BAMAN@ .nr LC @LCMAN@ .nr PS @PSMAN@ -.TH "SUDO" "@mansectsu@" "May 6, 2020" "Sudo @PACKAGE_VERSION@" "System Manager's Manual" +.TH "SUDO" "@mansectsu@" "May 7, 2020" "Sudo @PACKAGE_VERSION@" "System Manager's Manual" .nh .if n .ad l .SH "NAME" @@ -290,6 +290,7 @@ comma-separated list of environment variables to those preserved from the user's environment. The security policy may return an error if the user does not have permission to preserve the environment. +This option may be specified multiple times. .TP 12n \fB\-e\fR, \fB\--edit\fR Edit one or more files instead of running a command. @@ -686,7 +687,8 @@ option indicates that \fBsudo\fR should stop processing command line arguments. .PP -Options that take a value may only be specified once. +Options that take a value may only be specified once unless +otherwise indicated in the description. This is to help guard against problems caused by poorly written scripts that invoke \fBsudo\fR diff --git a/doc/sudo.mdoc.in b/doc/sudo.mdoc.in index 9c5de4cee..57295bb27 100644 --- a/doc/sudo.mdoc.in +++ b/doc/sudo.mdoc.in @@ -24,7 +24,7 @@ .nr BA @BAMAN@ .nr LC @LCMAN@ .nr PS @PSMAN@ -.Dd May 6, 2020 +.Dd May 7, 2020 .Dt SUDO @mansectsu@ .Os Sudo @PACKAGE_VERSION@ .Sh NAME @@ -280,6 +280,7 @@ comma-separated list of environment variables to those preserved from the user's environment. The security policy may return an error if the user does not have permission to preserve the environment. +This option may be specified multiple times. .It Fl e , -edit Edit one or more files instead of running a command. In lieu of a path name, the string "sudoedit" is used when consulting @@ -638,7 +639,8 @@ option indicates that should stop processing command line arguments. .El .Pp -Options that take a value may only be specified once. +Options that take a value may only be specified once unless +otherwise indicated in the description. This is to help guard against problems caused by poorly written scripts that invoke .Nm sudo diff --git a/src/parse_args.c b/src/parse_args.c index cbec75424..725684e4b 100644 --- a/src/parse_args.c +++ b/src/parse_args.c @@ -356,8 +356,6 @@ parse_args(int argc, char **argv, int *old_optind, int *nargc, char ***nargv, sudo_settings[ARG_PRESERVE_ENVIRONMENT].value = "true"; SET(flags, MODE_PRESERVE_ENV); } else { - if (extra_env.env_len != 0) - usage(); parse_env_list(&extra_env, optarg); } break;