]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Introduce earlier identification of command.com v.s. cmd.exe
authorWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 21 Mar 2002 06:04:27 +0000 (06:04 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Thu, 21 Mar 2002 06:04:27 +0000 (06:04 +0000)
  for Win32 .bat/.cmd scripts, and assure we treat command.com
  as a 16-bit application.  [William Rowe]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94077 13f79535-47bb-0310-9956-ffa450edef68

src/include/http_core.h
src/main/http_core.c
src/main/util_script.c

index 8ceaf730cff5c25ae0c6a12c61f03e2500e0f7cb..feecb1d92ff640818a745bcfe6cfb55ce34a940e 100644 (file)
@@ -158,7 +158,7 @@ API_EXPORT(const array_header *) ap_requires (request_rec *);
  * CGI Script stuff for Win32...
  */
 typedef enum { eFileTypeUNKNOWN, eFileTypeBIN, eFileTypeEXE16, eFileTypeEXE32, 
-               eFileTypeSCRIPT } file_type_e;
+               eFileTypeSCRIPT, eCommandShell16, eCommandShell32 } file_type_e;
 typedef enum { INTERPRETER_SOURCE_UNSET, INTERPRETER_SOURCE_REGISTRY, 
                INTERPRETER_SOURCE_SHEBANG } interpreter_source_e;
 API_EXPORT(file_type_e) ap_get_win32_interpreter(const request_rec *, char **);
index 0e1a8f8127880bb1d551549816605e2e12282479..d37b04bd83bae03e4e9f870174b640fa5962d643 100644 (file)
@@ -983,7 +983,7 @@ API_EXPORT (file_type_e) ap_get_win32_interpreter(const  request_rec *r,
     {
         char *p, *shellcmd = getenv("COMSPEC");
         if (!shellcmd)
-            shellcmd = SHELL_PATH;
+            return eFileTypeUNKNOWN;
         p = strchr(shellcmd, '\0');
         if ((p - shellcmd >= 11) && !strcasecmp(p - 11, "command.com")) 
         {
@@ -992,14 +992,16 @@ API_EXPORT (file_type_e) ap_get_win32_interpreter(const  request_rec *r,
             if (!strcasecmp(ext,".cmd"))
                 return eFileTypeUNKNOWN;
             *interpreter = ap_pstrcat(r->pool, "\"", shellcmd, "\" /C %1", NULL);
+            return eCommandShell16;
         }
-        else
+        else {
             /* Assume any other likes long paths, and knows .cmd,
              * but the entire /c arg should be double quoted, e.g.
              * "c:\path\cmd.exe" /c ""prog" "arg" "arg""
              */
             *interpreter = ap_pstrcat(r->pool, "\"", shellcmd, "\" /C \"\"%1\" %*\"", NULL);
-        return eFileTypeSCRIPT;
+            return eCommandShell32;
+        }
     }
 
     /* If the file has an extension and it is not .com and not .exe and
index 3fae2b54075b3eef52e2c9e9ab547a9eca70b1bf..b69a03974ec74c195d2f0d1a1c24c70d2fde7762 100644 (file)
@@ -1126,7 +1126,7 @@ API_EXPORT(int) ap_call_exec(request_rec *r, child_info *pinfo, char *argv0,
                           pEnvBlock,
                           ap_make_dirstr_parent(r->pool, r->filename),
                           &si, &pi)) {
-            if (fileType == eFileTypeEXE16) {
+            if (fileType == eFileTypeEXE16 || fileType == eCommandShell16) {
                 /* Hack to get 16-bit CGI's working. It works for all the 
                  * standard modules shipped with Apache. pi.dwProcessId is 0 
                  * for 16-bit CGIs and all the Unix specific code that calls