mod_netware.c revision 9e5410cf4f579668d32359a1ef7658a7866cf4d5
252N/A/* ==================================================================== 252N/A * The Apache Software License, Version 1.1 252N/A * Copyright (c) 2000-2002 The Apache Software Foundation. All rights 252N/A * Redistribution and use in source and binary forms, with or without 252N/A * modification, are permitted provided that the following conditions 252N/A * 1. Redistributions of source code must retain the above copyright 252N/A * notice, this list of conditions and the following disclaimer. 252N/A * 2. Redistributions in binary form must reproduce the above copyright 252N/A * notice, this list of conditions and the following disclaimer in 252N/A * the documentation and/or other materials provided with the 252N/A * 3. The end-user documentation included with the redistribution, 252N/A * if any, must include the following acknowledgment: 252N/A * "This product includes software developed by the 252N/A * Alternately, this acknowledgment may appear in the software itself, 252N/A * if and wherever such third-party acknowledgments normally appear. 252N/A * 4. The names "Apache" and "Apache Software Foundation" must 252N/A * not be used to endorse or promote products derived from this 252N/A * software without prior written permission. For written 252N/A * permission, please contact apache@apache.org. 252N/A * 5. Products derived from this software may not be called "Apache", 252N/A * nor may "Apache" appear in their name, without prior written 252N/A * permission of the Apache Software Foundation. 252N/A * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 252N/A * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 252N/A * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 252N/A * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 252N/A * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 252N/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 252N/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 252N/A * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 252N/A * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 252N/A * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 252N/A * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 252N/A * ==================================================================== 252N/A * This software consists of voluntary contributions made by many 252N/A * individuals on behalf of the Apache Software Foundation. For more 252N/A * information on the Apache Software Foundation, please see 252N/A * Portions of this software are based upon public domain software * originally written at the National Center for Supercomputing Applications, * University of Illinois, Urbana-Champaign. /* Skip on through Deep Space */ if (((*
ch ==
'$') || (*
ch ==
'%')) && (*(
ch +
1) ==
'*')) {
if (((*
ch ==
'$') || (*
ch ==
'%')) && (*(
ch +
1) ==
'1')) {
/* Todo: Make short name!!! */ if ((*
ch ==
'\"') && ((*(
ch +
1) ==
'$')
|| (*(
ch +
1) ==
'%')) && (*(
ch +
2) ==
'1')
&& (*(
ch +
3) ==
'\"')) {
/* Get 'em backslashes */ for (
sl = 0; *
ch ==
'\\'; ++
sl) {
/* last unmatched '\' + '"' sequence is a '"' */ /* '""' sequence within quotes is a '"' */ /* All other '"'s are Munched */ /* Anything else is, well, something else */ /* Term that arg, already pushed on args */ /* Handle the complete file name, we DON'T want to follow suexec, since * an unrooted command is as predictable as shooting craps in Win32. * Notice that unlike most mime extension parsing, we have to use the * win32 parsing here, therefore the final extension is the only one /* If it is an NLM then just execute it. */ "Could not find a command associated with the %s extension",
ext);
// /* If the file has an extension and it is not .com and not .exe and // * we've been instructed to search the registry, then do so. // * Let apr_proc_create do all of the .bat/.cmd dirty work. // if (ext && (!strcasecmp(ext,".exe") || !strcasecmp(ext,".com") // || !strcasecmp(ext,".bat") || !strcasecmp(ext,".cmd"))) { // if (!interpreter && ext // && (d->script_interpreter_source // == INTERPRETER_SOURCE_REGISTRY // || d->script_interpreter_source // == INTERPRETER_SOURCE_REGISTRY_STRICT)) { // /* Check the registry */ // int strict = (d->script_interpreter_source // == INTERPRETER_SOURCE_REGISTRY_STRICT); // interpreter = get_interpreter_from_win32_registry(r->pool, ext, // if (interpreter && *type != APR_SHELLCMD) { // *type = APR_PROGRAM_PATH; // ap_log_error(APLOG_MARK, APLOG_INFO, 0, r->server, // strict ? "No ExecCGI verb found for files of type '%s'." // : "No ExecCGI or Open verb found for files of type '%s'.", // apr_size_t bytes = sizeof(buffer); // /* Need to peek into the file figure out what it really is... // * ### aught to go back and build a cache for this one of these days. // if (((rv = apr_file_open(&fh, *cmd, APR_READ | APR_BUFFERED, // APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) // || ((rv = apr_file_read(fh, buffer, &bytes)) != APR_SUCCESS)) { // ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, // "Failed to read cgi file %s for testing", *cmd); // /* Script or executable, that is the question... */ // if ((buffer[0] == '#') && (buffer[1] == '!')) { // /* Assuming file is a script since it starts with a shebang */ // for (i = 2; i < sizeof(buffer); i++) { // if ((buffer[i] == '\r') || (buffer[i] == '\n')) { // if (i < sizeof(buffer)) { // interpreter = buffer + 2; // while (isspace(*interpreter)) { // if (*type != APR_SHELLCMD) { // *type = APR_PROGRAM_PATH; // /* Not a script, is it an executable? */ // IMAGE_DOS_HEADER *hdr = (IMAGE_DOS_HEADER*)buffer; // if ((bytes >= sizeof(IMAGE_DOS_HEADER)) // && (hdr->e_magic == IMAGE_DOS_SIGNATURE)) { // if (hdr->e_lfarlc < 0x40) { // /* Ought to invoke this 16 bit exe by a stub, (cmd /c?) */ // ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, // "%s is not executable; ensure interpreted scripts have " // "\"#!\" first line", *cmd); // *argv = (const char **)(split_argv(p, interpreter, *cmd, (
const char **
cmd,
const char ***
argv,
"full path to the CGI NLM module followed by one or more file extensions"),
NULL,
/* server config */ NULL,
/* merge server config */