akosut 96/06/17 13:43:51
Modified: src alloc.c http_protocol.c mod_cgi.c mod_proxy.c Log: Various OS/2 patches. Submitted by: Garey Smiley Revision Changes Path 1.6 +15 -3 apache/src/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C3 -r1.5 -r1.6 *** alloc.c 1996/06/03 12:04:19 1.5 --- alloc.c 1996/06/17 20:43:45 1.6 *************** *** 889,902 **** if (pipe_out) { close (out_fds[1]); *pipe_out = fdopen (out_fds[0], "r"); ! if (*pipe_out) note_cleanups_for_file (p, *pipe_out); } if (pipe_in) { close (in_fds[0]); *pipe_in = fdopen (in_fds[1], "w"); if (*pipe_in) note_cleanups_for_file (p, *pipe_in); } --- 889,912 ---- if (pipe_out) { close (out_fds[1]); + #ifdef __EMX__ + /* Need binary mode set for OS/2. */ + *pipe_out = fdopen (out_fds[0], "rb"); + #else *pipe_out = fdopen (out_fds[0], "r"); ! #endif ! if (*pipe_out) note_cleanups_for_file (p, *pipe_out); } if (pipe_in) { close (in_fds[0]); + #ifdef __EMX__ + /* Need binary mode set for OS/2 */ + *pipe_in = fdopen (in_fds[1], "wb"); + #else *pipe_in = fdopen (in_fds[1], "w"); + #endif if (*pipe_in) note_cleanups_for_file (p, *pipe_in); } *************** *** 1040,1053 **** if (pipe_out) { close (out_fds[1]); ! *pipe_out = fdopen (out_fds[0], "r"); if (*pipe_out) note_cleanups_for_file (p, *pipe_out); } if (pipe_in) { close (in_fds[0]); ! *pipe_in = fdopen (in_fds[1], "w"); if (*pipe_in) note_cleanups_for_file (p, *pipe_in); } --- 1050,1065 ---- if (pipe_out) { close (out_fds[1]); ! /* Need binary mode set for OS/2. */ ! *pipe_out = fdopen (out_fds[0], "rb"); if (*pipe_out) note_cleanups_for_file (p, *pipe_out); } if (pipe_in) { close (in_fds[0]); ! /* Need binary mode set for OS/2. */ ! *pipe_in = fdopen (in_fds[1], "wb"); if (*pipe_in) note_cleanups_for_file (p, *pipe_in); } 1.25 +16 -0 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C3 -r1.24 -r1.25 *** http_protocol.c 1996/06/17 20:17:02 1.24 --- http_protocol.c 1996/06/17 20:43:46 1.25 *************** *** 241,246 **** --- 241,251 ---- * But for now... */ + #ifdef __EMX__ + /* Variable for OS/2 fix below. */ + int loop; + #endif + /* A proxy request contains a ':' early on, but not as first character */ for (s=uri; s != '\0'; s++) if (!isalnum(*s) && *s != '+' && *s != '-' && *s != '.') break; *************** *** 254,259 **** --- 259,275 ---- { r->proxyreq = 0; r->uri = getword (r->pool, &uri, '?'); + + #ifdef __EMX__ + /* Handle path translations for OS/2 and plug security hole. */ + /* This will prevent "http://www.wherever.com/..\..\/" from + returning a directory for the root drive. */ + for (loop = 0; loop <= strlen(r->uri); ++loop) { + if (r->uri[loop] == '\\') + r->uri[loop] = '/'; + }; + #endif + if (*uri) r->args= uri; else r->args = NULL; } 1.10 +1 -1 apache/src/mod_cgi.c Index: mod_cgi.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_cgi.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C3 -r1.9 -r1.10 *** mod_cgi.c 1996/06/17 20:25:13 1.9 --- mod_cgi.c 1996/06/17 20:43:47 1.10 *************** *** 379,385 **** #ifdef __EMX__ if (nph) { while (fgets(argsbuffer, HUGE_STRING_LEN-1, script_in) != NULL) { ! fputs(argsbuffer, r->connection->client); } } #endif --- 379,385 ---- #ifdef __EMX__ if (nph) { while (fgets(argsbuffer, HUGE_STRING_LEN-1, script_in) != NULL) { ! bputs(argsbuffer, r->connection->client); } } #endif 1.28 +8 -0 apache/src/mod_proxy.c Index: mod_proxy.c =================================================================== RCS file: /export/home/cvs/apache/src/mod_proxy.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C3 -r1.27 -r1.28 *** mod_proxy.c 1996/06/13 21:11:57 1.27 --- mod_proxy.c 1996/06/17 20:43:48 1.28 *************** *** 2081,2092 **** --- 2081,2100 ---- *p='/'; ++p; } + #ifdef __EMX__ + /* Under OS/2 use rename. */ + if (rename(c->tempfile, c->filename) == -1) + log_uerror("rename", c->filename, "proxy: error renaming cache file", s); + } + #else + if (link(c->tempfile, c->filename) == -1) log_uerror("link", c->filename, "proxy: error linking cache file", s); } if (unlink(c->tempfile) == -1) log_uerror("unlink", c->tempfile, "proxy: error deleting temp file",s); + #endif garbage_coll(c->req); }