brian 98/05/08 19:28:32
Modified: src/modules/standard mod_cgi.c mod_include.c src CHANGES . STATUS Log: This is a fix to make this not a show-stopper anymore. Making a promise and breaking it every now and then is worse than not making that promise. Revision Changes Path 1.77 +2 -0 apache-1.3/src/modules/standard/mod_cgi.c Index: mod_cgi.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_cgi.c,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- mod_cgi.c 1998/04/22 15:06:45 1.76 +++ mod_cgi.c 1998/05/09 02:28:22 1.77 @@ -315,7 +315,9 @@ fprintf(dbg, "'%s'\n", env[i]); #endif +#ifndef WIN32 ap_chdir_file(r->filename); +#endif if (!cld->debug) ap_error_log2stderr(r->server); 1.85 +10 -1 apache-1.3/src/modules/standard/mod_include.c Index: mod_include.c =================================================================== RCS file: /export/home/cvs/apache-1.3/src/modules/standard/mod_include.c,v retrieving revision 1.84 retrieving revision 1.85 diff -u -r1.84 -r1.85 --- mod_include.c 1998/05/02 19:06:05 1.84 +++ mod_include.c 1998/05/09 02:28:22 1.85 @@ -607,7 +607,9 @@ } ap_destroy_sub_req(rr); +#ifndef WIN32 ap_chdir_file(r->filename); +#endif return 0; } @@ -699,8 +701,9 @@ if (!error_fmt && ap_run_sub_req(rr)) { error_fmt = "unable to include \"%s\" in parsed file %s"; } +#ifndef WIN32 ap_chdir_file(r->filename); - +#endif if (error_fmt) { ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r->server, error_fmt, tag_val, r->filename); @@ -845,7 +848,9 @@ ap_rputs(error, r); } /* just in case some stooge changed directories */ +#ifndef WIN32 ap_chdir_file(r->filename); +#endif } else if (!strcmp(tag, "cgi")) { parse_string(r, tag_val, parsed_string, sizeof(parsed_string), 0); @@ -855,7 +860,9 @@ ap_rputs(error, r); } /* grumble groan */ +#ifndef WIN32 ap_chdir_file(r->filename); +#endif } else if (!strcmp(tag, "done")) { return 0; @@ -2080,7 +2087,9 @@ printing = conditional_status = 1; if_nesting = 0; +#ifndef WIN32 ap_chdir_file(r->filename); +#endif if (r->args) { /* add QUERY stuff to env cause it ain't yet */ char *arg_copy = ap_pstrdup(r->pool, r->args); 1.836 +9 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.835 retrieving revision 1.836 diff -u -r1.835 -r1.836 --- CHANGES 1998/05/08 23:41:32 1.835 +++ CHANGES 1998/05/09 02:28:28 1.836 @@ -1,5 +1,14 @@ Changes with Apache 1.3b7 + *) chdir() doesn't make sense in a multithreaded environment like WIN32. + Before, Win32 CGI's could have had sporadic failures if a chdir call + from one thread was made between another chdir call and a spawn in + another thread. So, for now don't chdir for CGI scripts in WIN32. + The current CGI "spec" is unclear as to whether it's necessary. Long- + term fix is to either serialize the chdir/spawn combo or use WIN32 + native calls to spawn a process. This temp fix was necessary to remove + this as a showstopper for 1.3's release. [Brian Behlendorf] + *) Cleanup the suEXEC support in APACI and make it more safe: 1. Add big fat hint in INSTALL about risks and to read the htdocs/manual/suexec.html document before using the suexec-related 1.392 +4 -2 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /export/home/cvs/apache-1.3/STATUS,v retrieving revision 1.391 retrieving revision 1.392 diff -u -r1.391 -r1.392 --- STATUS 1998/05/09 01:23:12 1.391 +++ STATUS 1998/05/09 02:28:31 1.392 @@ -32,8 +32,6 @@ for buffer overflow, someone should rewrite or verify they're safe - * bad use of chdir in some places; it isn't thread-specific - Documentation that needs writing: * Documentation for: @@ -195,6 +193,10 @@ Ken: What's W95-specific about it? Help: + + * chdir() for CGI scripts and mod_include #exec needs to be + re-implemented. This requires either serializing chdir/spawn + or using a native Win32 CreateProcess(?) call. * process/thread model - need dynamic thread creation/destruction, similar to