From: Todd C. Miller Date: Tue, 26 Jan 2016 14:39:43 +0000 (-0700) Subject: Pass updated argv/envp to the I/O open function like the plugin API X-Git-Tag: SUDO_1_8_16^2~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca330adada9e02f9a45a8ecf7eddfc2548615655;p=sudo Pass updated argv/envp to the I/O open function like the plugin API documents. --- diff --git a/src/sudo.c b/src/sudo.c index d11a88ae2..4ec2ba6fb 100644 --- a/src/sudo.c +++ b/src/sudo.c @@ -249,6 +249,12 @@ main(int argc, char *argv[], char *envp[]) usage(1); exit(1); /* plugin printed error message */ } + /* Reset nargv/nargc based on argv_out. */ + /* XXX - leaks old nargv in shell mode */ + for (nargv = argv_out, nargc = 0; nargv[nargc] != NULL; nargc++) + continue; + if (nargc == 0) + sudo_fatalx(U_("plugin did not return a command to execute")); /* Open I/O plugins once policy plugin succeeds. */ TAILQ_FOREACH_SAFE(plugin, &io_plugins, entries, next) { ok = iolog_open(plugin, settings, user_info,