]> granicus.if.org Git - sudo/commitdiff
Pass updated argv/envp to the I/O open function like the plugin API
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 26 Jan 2016 14:39:43 +0000 (07:39 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 26 Jan 2016 14:39:43 +0000 (07:39 -0700)
documents.

src/sudo.c

index d11a88ae2ea873b7cd538534bf7f47cdb59d7c8f..4ec2ba6fb113af35b403d050af7465bb59e5e36f 100644 (file)
@@ -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,