httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: httpd-2.0/modules/arch/win32 mod_win32.c
Date Sat, 13 Apr 2002 22:34:16 GMT
wrowe       02/04/13 15:34:16

  Modified:    modules/arch/win32 mod_win32.c
  Log:
    Respect the process_cgi argument
  
  Revision  Changes    Path
  1.14      +24 -22    httpd-2.0/modules/arch/win32/mod_win32.c
  
  Index: mod_win32.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_win32.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- mod_win32.c	13 Apr 2002 19:55:00 -0000	1.13
  +++ mod_win32.c	13 Apr 2002 22:34:16 -0000	1.14
  @@ -413,25 +413,31 @@
   
   static apr_status_t ap_cgi_build_command(const char **cmd, const char ***argv,
                                            request_rec *r, apr_pool_t *p, 
  -                                         int replace_cmd, apr_cmdtype_e *type)
  +                                         int process_cgi, apr_cmdtype_e *type)
   {
       const char *ext = NULL;
       const char *interpreter = NULL;
       win32_dir_conf *d;
       apr_file_t *fh;
  -    const char *args = r->args;
  +    const char *args = "";
   
       d = (win32_dir_conf *)ap_get_module_config(r->per_dir_config, 
                                                  &win32_module);
   
  -    /* 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
  -     * we will consider
  -     */
  -    ext = strrchr(apr_filename_of_pathname(r->filename), '.');
  +    if (process_cgi) {
  +        /* 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
  +         * we will consider
  +         */
  +        *cmd = r->filename;
  +        if (r->args && r->args[0] && !ap_strchr_c(r->args, '='))
{
  +            args = r->args;
  +        }
  +    }
  +    ext = strrchr(apr_filename_of_pathname(*cmd), '.');
       
       /* 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.
  @@ -451,7 +457,7 @@
                         == INTERPRETER_SOURCE_REGISTRY_STRICT);
           interpreter = get_interpreter_from_win32_registry(r->pool, ext,
                                                             strict);
  -        if (interpreter) {
  +        if (interpreter && *type != APR_SHELLCMD) {
               *type = APR_PROGRAM_PATH;
           }
           else {
  @@ -470,12 +476,11 @@
           /* 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, r->filename, APR_READ | APR_BUFFERED,
  +        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",
  -                          r->filename);
  +                          "Failed to read cgi file %s for testing", *cmd);
               return rv;
           }
           apr_file_close(fh);
  @@ -494,7 +499,9 @@
                   while (isspace(*interpreter)) {
                       ++interpreter;
                   }
  -                *type = APR_PROGRAM_PATH;
  +                if (*type != APR_SHELLCMD) {
  +                    *type = APR_PROGRAM_PATH;
  +                }
               }
           }
           else {
  @@ -515,16 +522,11 @@
       if (!interpreter) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r,
                         "%s is not executable; ensure interpreted scripts have "
  -                      "\"#!\" first line", 
  -                      r->filename);
  +                      "\"#!\" first line", *cmd);
           return APR_EBADF;
       }
   
  -    if (!args || ap_strchr_c(args, '=')) {
  -        args = "";
  -    }
  -
  -    *argv = (const char **)(split_argv(p, interpreter, r->filename,
  +    *argv = (const char **)(split_argv(p, interpreter, *cmd,
                                          args)->elts);
       *cmd = (*argv)[0];
       return APR_SUCCESS;
  
  
  

Mime
View raw message