]> granicus.if.org Git - sudo/commitdiff
now sets cmnd_args global
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 22 Jul 1996 18:30:51 +0000 (18:30 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 22 Jul 1996 18:30:51 +0000 (18:30 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index c265090d26133755d9b937d2ab9ce086cabb679a..22312700618a023fb902a7db1f866405135932ca 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -138,6 +138,7 @@ char **NewArgv = NULL;
 struct passwd *user_pw_ent;
 char *runas_user = "root";
 char *cmnd = NULL;
+char *cmnd_args = NULL;
 char *tty = NULL;
 char *prompt = PASSPROMPT;
 char host[MAXHOSTNAMELEN + 1];
@@ -679,6 +680,14 @@ static void add_env(contiguous)
     if (NewArgc > 1)
        (void) free(buf);
 
+    /* grab a pointer to the flat arg string from the environment */
+    if (NewArgc > 1 && (cmnd_args = getenv("SUDO_COMMAND"))) {
+       if ((cmnd_args = strchr(cmnd_args, ' ')))
+           cmnd_args++;
+       else
+           cmnd_args = NULL;
+    }
+
     /* add the SUDO_USER envariable */
     if (sudo_setenv("SUDO_USER", user_name)) {
        perror("malloc");