]> granicus.if.org Git - apache/commitdiff
Added shebang check so that .vbs scripts can work as CGI.
authorGuenter Knauf <fuankg@apache.org>
Sun, 2 Jan 2011 04:33:28 +0000 (04:33 +0000)
committerGuenter Knauf <fuankg@apache.org>
Sun, 2 Jan 2011 04:33:28 +0000 (04:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1054347 13f79535-47bb-0310-9956-ffa450edef68

modules/arch/win32/mod_win32.c

index f711f7d50bd9dc7eb9b6d62e00e0268dd66bbeb1..b765b1c98630a504cdca0387d9afb115ea883175 100644 (file)
@@ -468,8 +468,11 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
             memmove(buffer, buffer + 3, bytes -= 3);
         }
 
-        /* Script or executable, that is the question... */
-        if ((bytes >= 2) && (buffer[0] == '#') && (buffer[1] == '!')) {
+        /* Script or executable, that is the question...
+         * we check here also for '! so that .vbs scripts can work as CGI.
+         */
+        if ((bytes >= 2) && ((buffer[0] == '#') || (buffer[0] == '\''))
+                         && (buffer[1] == '!')) {
             /* Assuming file is a script since it starts with a shebang */
             for (i = 2; i < bytes; i++) {
                 if ((buffer[i] == '\r') || (buffer[i] == '\n')) {
@@ -504,7 +507,7 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
     if (!interpreter) {
         ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                       "%s is not executable; ensure interpreted scripts have "
-                      "\"#!\" first line", *cmd);
+                      "\"#!\" or \"'!\" first line", *cmd);
         return APR_EBADF;
     }