@@ -93,6 +93,8 @@ static void *create_netware_dir_config(apr_pool_t *p, char *dir)
9393 new -> file_handler_mode = apr_table_make (p , 10 );
9494 new -> extra_env_vars = apr_table_make (p , 10 );
9595
96+ apr_table_set (new -> file_type_handlers , "NLM" , "OS" );
97+
9698 return new ;
9799}
98100
@@ -181,28 +183,30 @@ static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
181183 if (* ext == '.' )
182184 ++ ext ;
183185
184- /* If it is an NLM then just execute it. */
185- if (stricmp (ext , "nlm" )) {
186- /* check if we have a registered command for the extension*/
187- * cmd = apr_table_get (d -> file_type_handlers , ext );
188- if (* cmd == NULL ) {
189- ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r ,
190- "Could not find a command associated with the %s extension" , ext );
191- return APR_EBADF ;
192- }
193-
186+ /* check if we have a registered command for the extension*/
187+ * cmd = apr_table_get (d -> file_type_handlers , ext );
188+ if (* cmd == NULL ) {
189+ ap_log_rerror (APLOG_MARK , APLOG_ERR , 0 , r ,
190+ "Could not find a command associated with the %s extension" , ext );
191+ return APR_EBADF ;
192+ }
193+ if (!stricmp (* cmd , "OS" )) {
194+ /* If it is an NLM then restore *cmd and just execute it */
195+ * cmd = cmd_only ;
196+ }
197+ else {
194198 /* If we have a registered command then add the file that was passed in as a
195199 parameter to the registered command. */
196200 * cmd = apr_pstrcat (p , * cmd , " " , cmd_only , NULL );
197201
198202 /* Run in its own address space if specified */
199203 detached = apr_table_get (d -> file_handler_mode , ext );
200204 if (detached ) {
201- e_info -> cmd_type = APR_PROGRAM_ENV ;
205+ e_info -> cmd_type = APR_PROGRAM_ENV ;
206+ }
207+ else {
208+ e_info -> cmd_type = APR_PROGRAM ;
202209 }
203- else {
204- e_info -> cmd_type = APR_PROGRAM ;
205- }
206210 }
207211
208212 /* Tokenize the full command string into its arguments */
@@ -222,9 +226,10 @@ static void register_hooks(apr_pool_t *p)
222226
223227static const command_rec netware_cmds [] = {
224228AP_INIT_TAKE23 ("CGIMapExtension" , set_extension_map , NULL , OR_FILEINFO ,
225- "Full path to the CGI NLM module followed by a file extension. "
226- "The optional parameter \"detach\" can be specified if the NLM should "
227- "be launched in its own address space." ),
229+ "Full path to the CGI NLM module followed by a file extension. If the "
230+ "first parameter is set to \"OS\" then the following file extension is "
231+ "treated as NLM. The optional parameter \"detach\" can be specified if "
232+ "the NLM should be launched in its own address space." ),
228233{ NULL }
229234};
230235
0 commit comments