httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From W G Stoddard <wgsto...@us.ibm.com>
Subject [PATCH] #1 - ap_call_exec - bail if not executable
Date Tue, 16 Jun 1998 18:04:37 GMT
ap_call_exec patch #1.

If you request a file that resides in a script directory and that file:

o is not an executable (!is_exe)
o is not a binary (!is_binary)
o is not a script (!is_script, ie, it doesn't have a shebang line)

Then the server will pop up a window based error message saying
"...file name... is not a valid Windows NT Application."  This patch will fix
eliminate the error window.

Bill Stoddard
wgstodda@us.ibm.com

*** util_script.c.original Tue Jun 09 16:23:00 1998
--- util_script.c Tue Jun 16 13:42:02 1998
***************
*** 719,724 ****
--- 719,725 ----
   memset(&pi, 0, sizeof(pi));

   interpreter[0] = 0;
+  pid = -1;

   exename = strrchr(r->filename, '/');
   if (!exename)
***************
*** 772,777 ****
--- 773,787 ----
       }
   }

+         /* Bail out if we haven't figured out what kind of
+          * file this is by now..
+          */
+         if (!is_exe && !is_script && !is_binary) {
+             ap_log_error(APLOG_MARK, APLOG_ERR, r->server, "%s is not
executable",
+                          r->filename);
+             return (pid);
+         }
+
   /*
    * Make child process use hPipeOutputWrite as standard out,
    * and make sure it does not show on screen.
***************
*** 782,789 ****
   si.hStdInput   = pinfo->hPipeInputRead;
   si.hStdOutput  = pinfo->hPipeOutputWrite;
   si.hStdError   = pinfo->hPipeErrorWrite;
!
!  pid = -1;
   if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) {
       if (is_exe || is_binary) {
           /*
--- 792,798 ----
   si.hStdInput   = pinfo->hPipeInputRead;
   si.hStdOutput  = pinfo->hPipeOutputWrite;
   si.hStdError   = pinfo->hPipeErrorWrite;
!
   if ((!r->args) || (!r->args[0]) || strchr(r->args, '=')) {
       if (is_exe || is_binary) {
           /*




Users of the Apache webserver are hereby granted a non-exclusive, irrevocable,
world-wide, royalty-free, non-transferable license to use, execute, prepare
derivative works of, and distribute (internally and externally, and including
derivative works) the code accompanying this license as part of, and integrated
into the Apache webserver.

This code is provided "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTY OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK ARISING OUT OF THE USE
OR PERFORMANCE OF THIS CODE REMAINS WITH USERS OF THE APACHE WEBSERVER.

I represent and warrant that I am legally entitled to grant the above license.


Mime
View raw message