Download | Plain Text | Line Numbers


--- src/support/suexec.c.orig	2006-03-19 13:10:18.000000000 +0100
+++ src/support/suexec.c	2006-03-19 13:09:34.000000000 +0100
@@ -226,6 +226,18 @@
     environ = cleanenv;
 }
 
+static void addto_env(char *name, char *value)
+{
+    char envbuf[512];
+    int idx;
+
+    sprintf(envbuf, "%s=%s", name, value);
+    for(idx = 0; environ[idx]; idx++);
+    environ[idx] = strdup(envbuf);
+    idx++;
+    environ[idx] = NULL;
+}
+
 #define MY_STATE_NORMAL 0
 #define MY_STATE_SPACE 1
 #define MY_STATE_QUOTES 2
@@ -890,6 +902,7 @@
     /*
      * Execute the command, replacing our image with its own.
      */
+    addto_env("USER", actual_uname);
     execv(passedargv[0], passedargv);
 #if 0
 #ifdef NEED_HASHBANG_EMUL