You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ro...@imdb.com> on 1997/01/01 05:12:41 UTC

suexec modifications (fwd)

not acked

----- Forwarded message from Curtis Wilbar -----

From: Curtis Wilbar <cu...@ici.net>
Date: Tue, 31 Dec 1996 19:58:52 -0500 (EST)
Message-Id: <19...@pike.ici.net>
To: apache-bugs@apache.org
Subject: suexec modifications
Cc: curtis@ici.net


I could not compile suexec.c on our SunOS 4.x systems because the program
makes a call to setenv function that doesn't seem to exist....

I have made an ifdef in the code... Here is a context diff of my changes.

If used, and additional doc note on compiling will be needed:

"If you get an error about an undefined setenv function, add -DNOSETENV
 to your cc (or gcc) command line."

I am also workong on another mod that might be of interest to people
relating to how Apache uses suexec....  I'll forward any information
regarding that at such time.

I hope this is of use to someone... the context diff follows:

-----------------------------cut here-------------------------------
*** suexec.c.orig       Fri Dec 27 17:21:23 1996
--- suexec.c    Tue Dec 31 19:52:14 1996
***************
*** 120,125 ****
--- 120,153 ----
      return;
  }
  
+ 
+ /* [Curtis H. Wilbar Jr. 12/31/96]                  */
+ /* created a setenv call as SunOS does not have one */
+ /* to use this mod, add -DNOSETENV to your compile  */
+ #ifdef NOSETENV
+ int setenv(char vname[], char vvalue[], int overwrite) {
+ 
+    char *vnevv;
+    int  retval;
+ 
+    if ( overwrite || (getenv(vname) == NULL) ) {
+       vnevv = malloc(strlen(vname) + strlen(vvalue) + 2);
+ 
+       strcpy(vnevv, vname);
+       strcat(vnevv, "=");
+       strcat(vnevv, vvalue);
+ 
+       retval = putenv(vnevv);
+ 
+       free(vnevv);
+ 
+       return(retval);
+    } else {
+       return(-1);
+    }
+ }
+ #endif
+ 
  int main(int argc, char *argv[], char **env)
  {
      int doclen;             /* length of the docroot     */
-----------------------------cut here-------------------------------

I compiled with:

gcc -DNOSETENV -o suexec suexec.c

So far, I have checked and this is what I have found:

SunOS 4.x, Solaris 2.X, SCO 3.2 do not have the setenv function call
Linux (ver ?) does have setenv.

Please let me know if this is worthy of inclusion, and if so, I give
permission for inclusion into the Apache releases.

Thanks,

  -- Curt

Curtis H. Wilbar Jr.
Chief Technology Officer
The Internet Connection, Inc.
curtis@ici.net



----- End of forwarded message from Curtis Wilbar -----