Patch for NCSA httpd 1.1 seg fault problem
burchard@geom.umn.edu
Errors-To: secret@www0.cern.ch
Date: Mon, 7 Feb 1994 11:00:19 --100
Message-id: <9402050008.AA03868@mobius.geom.umn.edu>
Errors-To: secret@www0.cern.ch
Reply-To: www-talk@www0.cern.ch
Originator: www-talk@info.cern.ch
Sender: www-talk@www0.cern.ch
Precedence: bulk
From: burchard@geom.umn.edu
To: Multiple recipients of list <www-talk@www0.cern.ch>
Subject: Patch for NCSA httpd 1.1 seg fault problem
X-Listprocessor-Version: 6.0c -- ListProcessor by Anastasios Kotsikonas
Content-Length: 2412
NCSA httpd 1.1 assumes getenv("PATH") returns non-NULL.
This fails for example on our SGI Irix 4.0.5 server
running from inetd. Here is a patch to correct the
situation...sorry if this has already been mentioned.
*** httpd.h~ Fri Feb 4 17:48:47 1994
--- httpd.h Fri Feb 4 17:48:50 1994
***************
*** 213,218 ****
--- 213,221 ----
/* The name of the access file */
#define ACCESS_CONFIG_FILE "conf/access.conf"
+ /* Default PATH to be inherited by server scripts */
+ #define DEFAULT_PATH "/bin:/usr/bin:/usr/ucb:/usr/bsd:/usr/local/bin"
+
/* Whether we should enable rfc931 identity checking */
#define DEFAULT_RFC931 0
/* The default directory in user's home dir */
*** http_script.c~ Fri Feb 4 17:46:43 1994
--- http_script.c Fri Feb 4 17:57:30 1994
***************
*** 73,79 ****
int content, nph;
char cl[MAX_STRING_LEN],t[MAX_STRING_LEN],t2[MAX_STRING_LEN];
char path_args[MAX_STRING_LEN];
! char *argv0,**env;
FILE *psin;
struct stat finfo;
register int n,x;
--- 73,79 ----
int content, nph;
char cl[MAX_STRING_LEN],t[MAX_STRING_LEN],t2[MAX_STRING_LEN];
char path_args[MAX_STRING_LEN];
! char *argv0,**env,*env_path;
FILE *psin;
struct stat finfo;
register int n,x;
***************
*** 97,103 ****
if(!(env = (char **)malloc((MAX_CGI_VARS + 2) * sizeof(char *))))
die(NO_MEMORY,"exec_cgi_script",out);
n = 0;
! env[n++] = make_env_str("PATH",getenv("PATH"),out);
env[n++] = make_env_str("SERVER_SOFTWARE",SERVER_VERSION,out);
env[n++] = make_env_str("SERVER_NAME",server_hostname,out);
env[n++] = make_env_str("GATEWAY_INTERFACE","CGI/1.0",out);
--- 97,104 ----
if(!(env = (char **)malloc((MAX_CGI_VARS + 2) * sizeof(char *))))
die(NO_MEMORY,"exec_cgi_script",out);
n = 0;
! if(!(env_path = getenv("PATH"))) env_path = DEFAULT_PATH;
! env[n++] = make_env_str("PATH",env_path,out);
env[n++] = make_env_str("SERVER_SOFTWARE",SERVER_VERSION,out);
env[n++] = make_env_str("SERVER_NAME",server_hostname,out);
env[n++] = make_env_str("GATEWAY_INTERFACE","CGI/1.0",out);
--------------------------------------------------------------------
Paul Burchard <burchard@geom.umn.edu>
``I'm still learning how to count backwards from infinity...''
--------------------------------------------------------------------