From: Bradley Nicholes Date: Thu, 4 Dec 2003 21:31:22 +0000 (+0000) Subject: Allow for binary CGI's to have file extensions other than .NLM X-Git-Tag: 2.0.49~311 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1768854101c388886a247388046d8186b6d36b6d;p=thirdparty%2Fapache%2Fhttpd.git Allow for binary CGI's to have file extensions other than .NLM Submitted by: G�nter Knauf git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/APACHE_2_0_BRANCH@101990 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/arch/netware/mod_netware.c b/modules/arch/netware/mod_netware.c index be111d0493a..4ebfbb031b6 100644 --- a/modules/arch/netware/mod_netware.c +++ b/modules/arch/netware/mod_netware.c @@ -93,6 +93,8 @@ static void *create_netware_dir_config(apr_pool_t *p, char *dir) new->file_handler_mode = apr_table_make(p, 10); new->extra_env_vars = apr_table_make(p, 10); + apr_table_set(new->file_type_handlers, "NLM", "OS"); + return new; } @@ -170,7 +172,7 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, *ptr = '\0'; /* Figure out what the extension is so that we can matche it. */ - ext = strrchr(apr_filename_of_pathname(cmd_only), '.'); + ext = strrchr(apr_filepath_name_get(cmd_only), '.'); /* If there isn't an extension then give it an empty string */ if (!ext) { @@ -181,16 +183,18 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, 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; - } - + /* 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 (!stricmp(*cmd, "OS")) { + /* If it is an NLM then restore *cmd and just execute it */ + *cmd = cmd_only; + } + else { /* 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); @@ -198,11 +202,11 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv, /* Run in its own address space if specified */ detached = apr_table_get(d->file_handler_mode, ext); if (detached) { - e_info->cmd_type = APR_PROGRAM_ENV; + e_info->cmd_type = APR_PROGRAM_ENV; + } + else { + e_info->cmd_type = APR_PROGRAM; } - else { - e_info->cmd_type = APR_PROGRAM; - } } /* Tokenize the full command string into its arguments */ @@ -222,9 +226,10 @@ static void register_hooks(apr_pool_t *p) static const command_rec netware_cmds[] = { AP_INIT_TAKE23("CGIMapExtension", set_extension_map, NULL, OR_FILEINFO, - "Full path to the CGI NLM module followed by a file extension. " - "The optional parameter \"detach\" can be specified if the NLM should " - "be launched in its own address space."), + "Full path to the CGI NLM module followed by a file extension. If the " + "first parameter is set to \"OS\" then the following file extension is " + "treated as NLM. The optional parameter \"detach\" can be specified if " + "the NLM should be launched in its own address space."), { NULL } };