]> granicus.if.org Git - apache/commitdiff
Fix a long-standing bug in 2.0, CGI scripts were being called
authorRyan Bloom <rbb@apache.org>
Thu, 27 Jun 2002 06:07:58 +0000 (06:07 +0000)
committerRyan Bloom <rbb@apache.org>
Thu, 27 Jun 2002 06:07:58 +0000 (06:07 +0000)
with relative paths instead of absolute paths.  Apache 1.3 used
absolute paths for everything except for SuExec, this brings back
that standard.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95899 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/generators/mod_cgi.c
os/unix/unixd.c

diff --git a/CHANGES b/CHANGES
index bfae68757be6573d9d382ace82a26e7f39c89dd2..25358a51ffa87cb07ae1ed9125105edca0d4b2a9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.40
 
+  *) Fix a long-standing bug in 2.0, CGI scripts were being called
+     with relative paths instead of absolute paths.  Apache 1.3 used
+     absolute paths for everything except for SuExec, this brings back
+     that standard.  [Ryan Bloom]
+
   *) Fix infinite loop due to two HTTP_IN filters being present for
      internally redirected requests.  PR 10146.  [Justin Erenkrantz]
 
index b38a605d1968c835e6e4530b662d281b79e2f140..6fc59dd2ddf471dd894ed38c44be7d64a3d7e784 100644 (file)
@@ -513,13 +513,7 @@ static apr_status_t default_build_command(const char **cmd, const char ***argv,
     const char *args = NULL;
 
     if (e_info->process_cgi) {
-        /* Allow suexec's "/" check to succeed */
-        const char *argv0 = strrchr(r->filename, '/');
-        if (argv0 != NULL)
-            argv0++;
-        else
-            argv0 = r->filename;
-        *cmd = argv0;
+        *cmd = r->filename;
         args = r->args;
         /* Do not process r->args if they contain an '=' assignment 
          */
index c21868e38851c12b505f2fee81831ce898d6f7a7..515c430443f489e54017ea1975e4aed54c31110c 100644 (file)
@@ -326,11 +326,22 @@ static apr_status_t ap_unix_create_privileged_process(
     const char **newargs;
     char *newprogname;
     char *execuser, *execgroup;
+    const char *argv0;
 
     if (!unixd_config.suexec_enabled) {
         return apr_proc_create(newproc, progname, args, env, attr, p);
     }
 
+    argv0 = strrchr(progname, '/');
+    /* Allow suexec's "/" check to succeed */
+    if (argv0 != NULL) {
+        argv0++;
+    }
+    else {
+        argv0 = progname;
+    }
+
+
     if (ugid->userdir) {
         execuser = apr_psprintf(p, "~%ld", (long) ugid->uid);
     }
@@ -355,7 +366,7 @@ static apr_status_t ap_unix_create_privileged_process(
     newargs[0] = SUEXEC_BIN;
     newargs[1] = execuser;
     newargs[2] = execgroup;
-    newargs[3] = apr_pstrdup(p, progname);
+    newargs[3] = apr_pstrdup(p, argv0);
 
     /*
     ** using a shell to execute suexec makes no sense thus