You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Paul J. Reder" <re...@raleigh.ibm.com> on 1999/12/09 01:56:27 UTC

[Patch]: Fix a bug in 2.0 port of mod_include.

The attached patch is a first run at fixing mod_include to work 
under Apache 2.0 using APR. This patch will not yet work if the
"exec cmd" or "exec cgi" has to pass argv values. A post will
follow which describes what needs to be done to proc.c,
mod_rewrite.c, mod_include.c, and mod_cgi.c to make argv[]
passing work correctly.

-- 
Paul J. Reder
------------------------------------------------------------
"Remember, Information is not knowledge; Knowledge is not Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love;
Love is not music; Music is the best." -- Frank Zappa





Index: mod_include.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_include.c,v
retrieving revision 1.9
diff -u -r1.9 mod_include.c
--- mod_include.c       1999/12/02 18:36:37     1.9
+++ mod_include.c       1999/12/08 23:04:07
@@ -807,9 +807,8 @@



-static int include_cmd(char *s, request_rec *r)
+static int include_cmd(char *cmd_str, request_rec *r)
 {
-    include_cmd_arg arg;
     BUFF *script_in;
     ap_procattr_t *procattr;
     ap_proc_t *procnew;
@@ -820,14 +819,6 @@
     ap_file_t *file;
     ap_iol *iol;

-    arg.r = r;
-    arg.s = s;
-#ifdef TPF
-    arg.t.filename = r->filename;
-    arg.t.subprocess_env = r->subprocess_env;
-    arg.t.prog_type = FORK_FILE;
-#endif
-
     if (r->path_info && r->path_info[0] != '\0') {
         request_rec *pa_req;

@@ -853,21 +844,21 @@
     if ((ap_createprocattr_init(&procattr, r->pool) != APR_SUCCESS) ||
         (ap_setprocattr_io(procattr, APR_NO_PIPE,
                            APR_FULL_BLOCK, APR_NO_PIPE) != APR_SUCCESS) ||
-        (ap_setprocattr_dir(procattr, ap_make_dirstr_parent(r->pool, r->filename)) != APR_SUCCESS) ||
+        (ap_setprocattr_dir(procattr, ap_make_dirstr_parent(r->pool, cmd_str)) != APR_SUCCESS) ||
         (ap_setprocattr_cmdtype(procattr, APR_PROGRAM) != APR_SUCCESS)) {
         /* Something bad happened, tell the world. */
        ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
-                     "couldn't create child process: %s", r->filename);
+                     "couldn't create child process: %s", cmd_str);
         rc = !APR_SUCCESS;
     }
     else {
         build_argv_list(&argv, r, r->pool);
-        rc = ap_create_process(&procnew, r->filename, argv, ap_create_environment(r->pool, env), procattr, r->pool);
+        rc = ap_create_process(&procnew, cmd_str, argv, ap_create_environment(r->pool, env), procattr, r->pool);

         if (rc != APR_SUCCESS) {
             /* Bad things happened. Everyone should have cleaned up. */
             ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r,
-                        "couldn't create child process: %d: %s", rc, r->filename);
+                        "couldn't create child process: %d: %s", rc, cmd_str);
         }
         else {
 #ifndef WIN32