From 8753d7e167f95cc7a0a654316f55a1e5937cfadb Mon Sep 17 00:00:00 2001 From: Guenter Knauf Date: Sun, 2 Jan 2011 04:33:28 +0000 Subject: [PATCH] Added shebang check so that .vbs scripts can work as CGI. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1054347 13f79535-47bb-0310-9956-ffa450edef68 --- modules/arch/win32/mod_win32.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/arch/win32/mod_win32.c b/modules/arch/win32/mod_win32.c index f711f7d50b..b765b1c986 100644 --- a/modules/arch/win32/mod_win32.c +++ b/modules/arch/win32/mod_win32.c @@ -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; } -- 2.50.0