From 9da79ecfa92456adb09ddf1a9b202b6aea1c2bf3 Mon Sep 17 00:00:00 2001 From: Bradley Nicholes Date: Fri, 11 Oct 2002 17:31:09 +0000 Subject: [PATCH] Fixed a problem with the NetWare command line builder for building the CGI command line. It did not handle building the command line when given a script rather than an executible. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@97181 13f79535-47bb-0310-9956-ffa450edef68 --- modules/arch/netware/mod_netware.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/arch/netware/mod_netware.c b/modules/arch/netware/mod_netware.c index 4d9007c852..5e6cf0b69d 100644 --- a/modules/arch/netware/mod_netware.c +++ b/modules/arch/netware/mod_netware.c @@ -112,12 +112,25 @@ static void *merge_netware_dir_configs(apr_pool_t *p, void *basev, void *addv) static const char *set_extension_map(cmd_parms *cmd, netware_dir_config *m, char *CGIhdlr, char *ext, char *detach) { + int i, len; + if (*ext == '.') ++ext; + + if (CGIhdlr != NULL) { + len = strlen(CGIhdlr); + for (i=0; ifile_type_handlers, ext, CGIhdlr); if (detach) { apr_table_set(m->file_handler_mode, ext, "y"); } + return NULL; } @@ -148,34 +161,47 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, args = r->args; } } + cmd_only = apr_pstrdup(p, *cmd); /* truncate any arguments from the cmd */ for (ptr = cmd_only; *ptr && (*ptr != ' '); ptr++); *ptr = '\0'; + /* Figure out what the extension is so that we can matche it. */ ext = strrchr(apr_filename_of_pathname(cmd_only), '.'); + /* eliminate the '.' if there is one */ if (*ext == '.') ++ext; /* If it is an NLM then just execute it. */ if (stricmp(ext, "nlm")) { + /* check if we have a registered command for the extension*/ *cmd = apr_table_get(d->file_type_handlers, ext); if (*cmd == NULL) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Could not find a command associated with the %s extension", ext); return APR_EBADF; } + + /* If we have a registered command then add the file that was passed in as a + parameter to the registered command. */ + *cmd = apr_pstrcat (p, *cmd, " ", cmd_only, NULL); + + /* Run in its own address space if specified */ detached = apr_table_get(d->file_handler_mode, ext); if (detached) { e_info->detached = 1; } } + /* Tokenize the full command string into its arguments */ apr_tokenize_to_argv(*cmd, (char***)argv, p); e_info->cmd_type = APR_PROGRAM; - *cmd = ap_server_root_relative(p, cmd_only); + + /* The first argument should be the executible */ + *cmd = ap_server_root_relative(p, *argv[0]); return APR_SUCCESS; } -- 2.50.1