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/server config.c core.c log.c mpm_common.c scoreboard.c
Date Sat, 16 Mar 2002 18:26:58 GMT
wrowe       02/03/16 10:26:58

  Modified:    .        InstallBin.dsp
               modules/arch/win32 mod_isapi.c
               modules/cache mod_file_cache.c
               modules/dav/fs mod_dav_fs.c
               modules/generators mod_cgi.c mod_cgid.c
               modules/http mod_mime.c
               modules/loggers mod_log_config.c
               modules/mappers mod_alias.c mod_rewrite.c mod_so.c
               modules/metadata mod_mime_magic.c
               modules/proxy proxy_ftp.c
               server   config.c core.c log.c mpm_common.c scoreboard.c
  Log:
    Eliminate potential ap_server_root_relative segfaults, with the input
    of Jeff Trawick's style changes to the first patches.  Doesn't include
    the fixes to ssl [more complex], and we won't trap errors that involve
    ap_serverroot, since we presume that was normalized on the way in.
    Therefore, testing ap_server_root_relative(DEFAULT_FOO) cases
    should never become necessary.
  
  Revision  Changes    Path
  1.19      +2 -3      httpd-2.0/InstallBin.dsp
  
  Index: InstallBin.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/InstallBin.dsp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- InstallBin.dsp	29 Jan 2002 18:16:54 -0000	1.18
  +++ InstallBin.dsp	16 Mar 2002 18:26:56 -0000	1.19
  @@ -1,5 +1,5 @@
   # Microsoft Developer Studio Project File - Name="InstallBin" - Package Owner=<4>
  -# Microsoft Developer Studio Generated Build File, Format Version 6.00
  +# Microsoft Developer Studio Generated Build File, Format Version 5.00
   # ** DO NOT EDIT **
   
   # TARGTYPE "Win32 (x86) External Target" 0x0106
  @@ -22,7 +22,6 @@
   !MESSAGE 
   
   # Begin Project
  -# PROP AllowPerConfigDependencies 0
   # PROP Scc_ProjName ""
   # PROP Scc_LocalPath ""
   
  @@ -58,7 +57,7 @@
   # PROP Use_Debug_Libraries 1
   # PROP Output_Dir "Debug"
   # PROP Intermediate_Dir "Debug"
  -# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\Apache2" SHORT=D LONG=Debug _install"
  +# PROP Cmd_Line "NMAKE /f makefile.win INSTDIR="\test\Apache2.0.33" SHORT=D LONG=Debug
_install"
   # PROP Rebuild_Opt ""
   # PROP Target_File "\Apache2\bin\Apache.exe"
   # PROP Bsc_Name ""
  
  
  
  1.61      +10 -5     httpd-2.0/modules/arch/win32/mod_isapi.c
  
  Index: mod_isapi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_isapi.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- mod_isapi.c	15 Mar 2002 16:58:27 -0000	1.60
  +++ mod_isapi.c	16 Mar 2002 18:26:57 -0000	1.61
  @@ -1232,15 +1232,20 @@
       char *fspec;
       
       fspec = ap_server_root_relative(cmd->pool, filename);
  -    if (!fspec || (rv = apr_stat(&tmp, fspec, APR_FINFO_TYPE, 
  -                                 cmd->temp_pool)) != APR_SUCCESS) { 
  +    if (!fspec) {
  +	ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
  +	             "ISAPI: Invalid module path %s, skipping", filename);
  +	return NULL;
  +    }
  +    if ((rv = apr_stat(&tmp, fspec, APR_FINFO_TYPE, 
  +                      cmd->temp_pool)) != APR_SUCCESS) { 
   	ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
  -	    "ISAPI: unable to stat(%s), skipping", filename);
  +	    "ISAPI: unable to stat(%s), skipping", fspec);
   	return NULL;
       }
       if (tmp.filetype != APR_REG) {
   	ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server,
  -	    "ISAPI: %s isn't a regular file, skipping", filename);
  +	    "ISAPI: %s isn't a regular file, skipping", fspec);
   	return NULL;
       }
   
  @@ -1248,7 +1253,7 @@
       rv = isapi_load(cmd->pool, sconf, NULL, fspec, &isa); 
       if (rv != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_WARNING, rv, cmd->server,
  -                     "ISAPI: unable to cache %s, skipping", filename);
  +                     "ISAPI: unable to cache %s, skipping", fspec);
   	return NULL;
       }
   
  
  
  
  1.69      +4 -3      httpd-2.0/modules/cache/mod_file_cache.c
  
  Index: mod_file_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/cache/mod_file_cache.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- mod_file_cache.c	15 Mar 2002 20:43:03 -0000	1.68
  +++ mod_file_cache.c	16 Mar 2002 18:26:57 -0000	1.69
  @@ -197,14 +197,15 @@
   
       fspec = ap_server_root_relative(cmd->pool, filename);
       if (!fspec) {
  -        ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, 0, cmd->server,
  -                     "mod_file_cache: unable to find relative path for "
  +        ap_log_error(APLOG_MARK, APLOG_WARNING, APR_EBADPATH, cmd->server,
  +                     "mod_file_cache: invalid file path "
                        "%s, skipping", filename);
  +	return;
       }
       if ((rc = apr_stat(&tmp.finfo, fspec, APR_FINFO_MIN, 
                                    cmd->temp_pool)) != APR_SUCCESS) {
   	ap_log_error(APLOG_MARK, APLOG_WARNING, rc, cmd->server,
  -	    "mod_file_cache: unable to stat(%s), skipping", filename);
  +	    "mod_file_cache: unable to stat(%s), skipping", fspec);
   	return;
       }
       if (tmp.finfo.filetype != APR_REG) {
  
  
  
  1.17      +6 -1      httpd-2.0/modules/dav/fs/mod_dav_fs.c
  
  Index: mod_dav_fs.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/dav/fs/mod_dav_fs.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- mod_dav_fs.c	13 Mar 2002 20:47:45 -0000	1.16
  +++ mod_dav_fs.c	16 Mar 2002 18:26:57 -0000	1.17
  @@ -54,6 +54,7 @@
   
   #include "httpd.h"
   #include "http_config.h"
  +#include "apr_strings.h"
   
   #include "mod_dav.h"
   #include "repos.h"
  @@ -101,10 +102,14 @@
                                           const char *arg1)
   {
       dav_fs_server_conf *conf;
  -
       conf = ap_get_module_config(cmd->server->module_config,
                                   &dav_fs_module);
       conf->lockdb_path = ap_server_root_relative(cmd->pool, arg1);
  +
  +    if (!conf->lockdb_path) {
  +        return apr_pstrcat(cmd->pool, "Invalid DAVLockDB path ",
  +                           arg1, NULL);
  +    }
   
       return NULL;
   }
  
  
  
  1.121     +6 -0      httpd-2.0/modules/generators/mod_cgi.c
  
  Index: mod_cgi.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
  retrieving revision 1.120
  retrieving revision 1.121
  diff -u -r1.120 -r1.121
  --- mod_cgi.c	14 Mar 2002 22:19:13 -0000	1.120
  +++ mod_cgi.c	16 Mar 2002 18:26:57 -0000	1.121
  @@ -165,6 +165,12 @@
                                                    &cgi_module);
   
       conf->logname = ap_server_root_relative(cmd->pool, arg);
  +
  +    if (!conf->logname) {
  +        return apr_pstrcat(cmd->pool, "Invalid ScriptLog path ",
  +                           arg, NULL);
  +    }
  +
       return NULL;
   }
   
  
  
  
  1.117     +11 -0     httpd-2.0/modules/generators/mod_cgid.c
  
  Index: mod_cgid.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -r1.116 -r1.117
  --- mod_cgid.c	14 Mar 2002 22:19:13 -0000	1.116
  +++ mod_cgid.c	16 Mar 2002 18:26:57 -0000	1.117
  @@ -722,6 +722,11 @@
                                                     &cgid_module); 
   
       conf->logname = ap_server_root_relative(cmd->pool, arg);
  +
  +    if (!conf->logname) {
  +        return apr_pstrcat(cmd->pool, "Invalid ScriptLog path ",
  +                           arg1, NULL);
  +    }
       return NULL; 
   } 
   
  @@ -752,6 +757,12 @@
                                                     &cgid_module); 
   
       conf->sockname = ap_server_root_relative(cmd->pool, arg); 
  +
  +    if (!conf->sockname) {
  +        return apr_pstrcat(cmd->pool, "Invalid Scriptsock path ",
  +                           arg, NULL);
  +    }
  +
       return NULL; 
   } 
   
  
  
  
  1.78      +10 -3     httpd-2.0/modules/http/mod_mime.c
  
  Index: mod_mime.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/mod_mime.c,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- mod_mime.c	13 Mar 2002 20:47:49 -0000	1.77
  +++ mod_mime.c	16 Mar 2002 18:26:57 -0000	1.78
  @@ -439,10 +439,17 @@
           types_confname = AP_TYPES_CONFIG_FILE;
   
       types_confname = ap_server_root_relative(p, types_confname);
  -
  -    if ((status = ap_pcfg_openfile(&f, ptemp, types_confname)) != APR_SUCCESS) {
  +    if (!types_confname) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
  +		     "Invalid mime types config path %s", 
  +                     ap_get_module_config(s->module_config, &mime_module));
  +        return HTTP_INTERNAL_SERVER_ERROR;
  +    }
  +    if ((status = ap_pcfg_openfile(&f, ptemp, types_confname)) 
  +                != APR_SUCCESS) {
           ap_log_error(APLOG_MARK, APLOG_ERR, status, s,
  -		     "could not open mime types config file %s.", types_confname);
  +		     "could not open mime types config file %s.", 
  +                     types_confname);
           return HTTP_INTERNAL_SERVER_ERROR;
       }
   
  
  
  
  1.80      +7 -2      httpd-2.0/modules/loggers/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_config.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- mod_log_config.c	13 Mar 2002 20:47:50 -0000	1.79
  +++ mod_log_config.c	16 Mar 2002 18:26:57 -0000	1.80
  @@ -1062,8 +1062,13 @@
       }
       else {
           const char *fname = ap_server_root_relative(p, cls->fname);
  -        if ((status = apr_file_open(&cls->log_fd, fname, xfer_flags, xfer_perms,
p)) 
  -            != APR_SUCCESS) {
  +        if (!fname) {
  +            ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
  +                         "invalid transfer log path %s.", cls->fname);
  +            exit(1);
  +        }
  +        if ((status = apr_file_open(&cls->log_fd, fname, xfer_flags,
  +                                    xfer_perms, p)) != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_ERR, status, s,
                            "could not open transfer log file %s.", fname);
               exit(1);
  
  
  
  1.38      +6 -3      httpd-2.0/modules/mappers/mod_alias.c
  
  Index: mod_alias.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_alias.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_alias.c	13 Mar 2002 20:47:50 -0000	1.37
  +++ mod_alias.c	16 Mar 2002 18:26:57 -0000	1.38
  @@ -382,11 +382,14 @@
               /* XXX This is as SLOW as can be, next step, we optimize
                * and merge to whatever part of the found path was already
                * canonicalized.  After I finish eliminating os canonical.
  +             * Better fail test for ap_server_root_relative needed here.
                */
  -            if (!doesc)
  +            if (!doesc) {
                   found = ap_server_root_relative(r->pool, found);
  -	    *status = p->redir_status;
  -
  +            }
  +            if (found) {
  +	        *status = p->redir_status;
  +            }
   	    return found;
   	}
   
  
  
  
  1.102     +16 -8     httpd-2.0/modules/mappers/mod_rewrite.c
  
  Index: mod_rewrite.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
  retrieving revision 1.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- mod_rewrite.c	14 Mar 2002 22:19:14 -0000	1.101
  +++ mod_rewrite.c	16 Mar 2002 18:26:57 -0000	1.102
  @@ -501,7 +501,12 @@
       if ((error = ap_check_cmd_context(cmd, GLOBAL_ONLY)) != NULL)
           return error;
   
  -    lockname = a1;
  +    /* fixup the path, especially for rewritelock_remove() */
  +    lockname = ap_server_root_relative(cmd->pool, a1);
  +
  +    if (!lockname) {
  +        return apr_pstrcat(cmd->pool, "Invalid RewriteLock path ", a1);
  +    }
   
       return NULL;
   }
  @@ -3115,8 +3120,6 @@
           return; /* virtual log shared w/ main server */
       }
   
  -    fname = ap_server_root_relative(p, conf->rewritelogfile);
  -
       if (*conf->rewritelogfile == '|') {
           if ((pl = ap_open_piped_log(p, conf->rewritelogfile+1)) == NULL) {
               ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s, 
  @@ -3127,8 +3130,16 @@
           conf->rewritelogfp = ap_piped_log_write_fd(pl);
       }
       else if (*conf->rewritelogfile != '\0') {
  -        rc = apr_file_open(&conf->rewritelogfp, fname, rewritelog_flags, rewritelog_mode,
p);
  -        if (rc != APR_SUCCESS)  {
  +        fname = ap_server_root_relative(p, conf->rewritelogfile);
  +        if (!fname) {
  +            ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s, 
  +                         "mod_rewrite: Invalid RewriteLog "
  +                         "path %s", conf->rewritelogfile);
  +            exit(1);
  +        }
  +        if ((rc = apr_file_open(&conf->rewritelogfp, fname, 
  +                                rewritelog_flags, rewritelog_mode, p))
  +                != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_ERR, rc, s, 
                            "mod_rewrite: could not open RewriteLog "
                            "file %s", fname);
  @@ -3263,9 +3274,6 @@
       if (lockname == NULL || *(lockname) == '\0') {
           return;
       }
  -
  -    /* fixup the path, especially for rewritelock_remove() */
  -    lockname = ap_server_root_relative(p, lockname);
   
       /* create the lockfile */
       rc = apr_global_mutex_create(&rewrite_mapr_lock_acquire, lockname,
  
  
  
  1.48      +3 -9      httpd-2.0/modules/mappers/mod_so.c
  
  Index: mod_so.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- mod_so.c	15 Mar 2002 15:31:17 -0000	1.47
  +++ mod_so.c	16 Mar 2002 18:26:57 -0000	1.48
  @@ -200,7 +200,7 @@
       apr_dso_handle_t *modhandle;
       apr_dso_handle_sym_t modsym;
       module *modp;
  -    const char *szModuleFile=ap_server_root_relative(cmd->pool, filename);
  +    const char *szModuleFile = ap_server_root_relative(cmd->pool, filename);
       so_server_conf *sconf;
       moduleinfo *modi;
       moduleinfo *modie;
  @@ -212,11 +212,8 @@
        */
       *(ap_directive_t **)dummy = NULL;
   
  -    /* ap_server_root_relative returns NULL if the paths couldn't be
  -     * merged (one is corrupt - dollars to donuts it's the named module
  -     */
       if (!szModuleFile) {
  -        return apr_pstrcat(cmd->pool, "Cannot parse module name ", 
  +        return apr_pstrcat(cmd->pool, "Invalid LoadModule path ", 
                              filename, NULL);
       }
   
  @@ -312,11 +309,8 @@
   
       file = ap_server_root_relative(cmd->pool, filename);
       
  -    /* ap_server_root_relative returns NULL if the paths couldn't be
  -     * merged (one is corrupt - dollars to donuts it's the named module
  -     */
       if (!file) {
  -        return apr_pstrcat(cmd->pool, "Cannot parse file name ", 
  +        return apr_pstrcat(cmd->pool, "Invalid LoadFile path ", 
                              filename, NULL);
       }
   
  
  
  
  1.54      +9 -4      httpd-2.0/modules/metadata/mod_mime_magic.c
  
  Index: mod_mime_magic.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_mime_magic.c,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- mod_mime_magic.c	14 Mar 2002 22:19:14 -0000	1.53
  +++ mod_mime_magic.c	16 Mar 2002 18:26:58 -0000	1.54
  @@ -964,12 +964,17 @@
   #endif
       magic_server_config_rec *conf = (magic_server_config_rec *)
   		    ap_get_module_config(s->module_config, &mime_magic_module);
  -
       const char *fname = ap_server_root_relative(p, conf->magicfile);
  -    result = apr_file_open(&f, fname, APR_READ | APR_BUFFERED, APR_OS_DEFAULT, p);
  -    if (result != APR_SUCCESS) {
  +
  +    if (!fname) {
  +	ap_log_error(APLOG_MARK, APLOG_ERR, APR_EBADPATH, s,
  +		     MODNAME ": Invalid magic file path %s", conf->magicfile);
  +	return -1;
  +    }        
  +    if ((result = apr_file_open(&f, fname, APR_READ | APR_BUFFERED, 
  +                                APR_OS_DEFAULT, p) != APR_SUCCESS)) {
   	ap_log_error(APLOG_MARK, APLOG_ERR, result, s,
  -		    MODNAME ": can't read magic file %s", fname);
  +		     MODNAME ": can't read magic file %s", fname);
   	return -1;
       }
   
  
  
  
  1.114     +5 -5      httpd-2.0/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.113
  retrieving revision 1.114
  diff -u -r1.113 -r1.114
  --- proxy_ftp.c	9 Mar 2002 07:15:33 -0000	1.113
  +++ proxy_ftp.c	16 Mar 2002 18:26:58 -0000	1.114
  @@ -370,7 +370,7 @@
   
           /* Copy path, strip (all except the last) trailing slashes */
           /* (the trailing slash is needed for the dir component loop below) */
  -        path = dir = ap_pstrcat(p, path, "/", NULL);
  +        path = dir = apr_pstrcat(p, path, "/", NULL);
           for (n = strlen(path); n > 1 && path[n - 1] == '/' && path[n
- 2] == '/'; --n)
               path[n - 1] = '\0';
   
  @@ -569,9 +569,9 @@
   
               filename = apr_pstrndup(p, &ctx->buffer[re_result[2].rm_so], re_result[2].rm_eo
- re_result[2].rm_so);
   
  -            str = ap_pstrcat(p, ap_escape_html(p, apr_pstrndup(p, ctx->buffer, re_result[2].rm_so)),
  -                             "<a href=\"", ap_escape_uri(p, filename), "\">",
  -                             ap_escape_html(p, filename), "</a>\n", NULL);
  +            str = apr_pstrcat(p, ap_escape_html(p, apr_pstrndup(p, ctx->buffer, re_result[2].rm_so)),
  +                              "<a href=\"", ap_escape_uri(p, filename), "\">",
  +                              ap_escape_html(p, filename), "</a>\n", NULL);
           }
           else {
               strcat(ctx->buffer, "\n"); /* re-append the newline */
  @@ -851,7 +851,7 @@
   
           /* Check valid types, rather than ignoring invalid types silently: */
           if (strchr("AEI", xfer_type) == NULL)
  -            return ap_proxyerror(r, HTTP_BAD_REQUEST, ap_pstrcat(r->pool,
  +            return ap_proxyerror(r, HTTP_BAD_REQUEST, apr_pstrcat(r->pool,
                                       "ftp proxy supports only types 'a', 'i', or 'e': \"",
                                       type_suffix, "\" is invalid.", NULL));
       }
  
  
  
  1.148     +16 -3     httpd-2.0/server/config.c
  
  Index: config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/config.c,v
  retrieving revision 1.147
  retrieving revision 1.148
  diff -u -r1.147 -r1.148
  --- config.c	15 Mar 2002 09:50:14 -0000	1.147
  +++ config.c	16 Mar 2002 18:26:58 -0000	1.148
  @@ -1209,11 +1209,17 @@
        * This allows most args to be independent of server_root,
        * so the server can be moved or mirrored with less pain.
        */
  -    const char *p;
  +    const char *path;
       int offset = (int)(long)cmd->info;
   
  -    p = ap_server_root_relative(cmd->pool, arg);
  -    *(const char **) ((char*)struct_ptr + offset) = p;
  +    path = ap_server_root_relative(cmd->pool, arg);
  +
  +    if (!path) {
  +        return apr_pstrcat(cmd->pool, "Invalid file path ",
  +                           arg, NULL);
  +    }
  +
  +    *(const char **) ((char*)struct_ptr + offset) = path;
   
       return NULL;
   }
  @@ -1756,6 +1762,13 @@
        * compute this config file name afterwards.
        */
       confname = ap_server_root_relative(p, filename);
  +
  +    if (!confname) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT,
  +                     APR_EBADPATH, NULL, "Invalid config file path %s",
  +                     filename);
  +        exit(1);
  +    }
   
       ap_process_resource_config(s, confname, conftree, p, ptemp);
   
  
  
  
  1.163     +13 -8     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.162
  retrieving revision 1.163
  diff -u -r1.162 -r1.163
  --- core.c	13 Mar 2002 20:47:59 -0000	1.162
  +++ core.c	16 Mar 2002 18:26:58 -0000	1.163
  @@ -1364,15 +1364,15 @@
               bit = ETAG_INODE;
           }
           else {
  -            return ap_pstrcat(cmd->pool, "Unknown keyword '",
  -                              token, "' for ", cmd->cmd->name,
  -                              " directive", NULL);
  +            return apr_pstrcat(cmd->pool, "Unknown keyword '",
  +                               token, "' for ", cmd->cmd->name,
  +                               " directive", NULL);
           }
   
           if (! valid) {
  -            return ap_pstrcat(cmd->pool, cmd->cmd->name, " keyword '",
  -                              token, "' cannot be used with '+' or '-'",
  -                              NULL);
  +            return apr_pstrcat(cmd->pool, cmd->cmd->name, " keyword '",
  +                               token, "' cannot be used with '+' or '-'",
  +                               NULL);
           }
   
           if (action == '+') {
  @@ -2126,9 +2126,14 @@
                                      const char *name)
   {
       ap_directive_t *conftree = NULL;
  +    const char* conffile = ap_server_root_relative(cmd->pool, name);
  +    
  +    if (!conffile) {
  +        return apr_pstrcat(cmd->pool, "Invalid Include path ", 
  +                           name, NULL);
  +    }
   
  -    ap_process_resource_config(cmd->server,
  -                               ap_server_root_relative(cmd->pool, name),
  +    ap_process_resource_config(cmd->server, conffile,
                                  &conftree, cmd->pool, cmd->temp_pool);
       *(ap_directive_t **)dummy = conftree;
       return NULL;
  
  
  
  1.112     +22 -9     httpd-2.0/server/log.c
  
  Index: log.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/log.c,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -r1.111 -r1.112
  --- log.c	14 Mar 2002 22:19:14 -0000	1.111
  +++ log.c	16 Mar 2002 18:26:58 -0000	1.112
  @@ -263,13 +263,18 @@
   #endif
       else {
           fname = ap_server_root_relative(p, s->error_fname);
  -        rc = apr_file_open(&s->error_log, fname,
  -                           APR_APPEND | APR_READ | APR_WRITE | APR_CREATE,
  -                           APR_OS_DEFAULT, p);
  -        if (rc != APR_SUCCESS) {
  +        if (!fname) {
  +            ap_log_error(APLOG_MARK, APLOG_STARTUP, APR_EBADPATH, NULL,
  +                         "%s: Invalid error log path %s.",
  +                         ap_server_argv0, s->error_fname);
  +            exit(1);
  +        }
  +        if ((rc = apr_file_open(&s->error_log, fname,
  +                               APR_APPEND | APR_READ | APR_WRITE | APR_CREATE,
  +                               APR_OS_DEFAULT, p)) != APR_SUCCESS) {
               ap_log_error(APLOG_MARK, APLOG_STARTUP, rc, NULL,
                            "%s: could not open error log file %s.",
  -            ap_server_argv0, fname);
  +                         ap_server_argv0, s->error_fname);
               exit(1);
           }
   
  @@ -535,18 +540,26 @@
       va_end(args);
   }
   
  -AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *fname)
  +AP_DECLARE(void) ap_log_pid(apr_pool_t *p, const char *filename)
   {
       apr_file_t *pid_file = NULL;
       apr_finfo_t finfo;
       static pid_t saved_pid = -1;
       pid_t mypid;
       apr_status_t rv;
  +    const char *fname;
   
  -    if (!fname)
  -    return;
  +    if (!filename) {
  +        return;
  +    }
  +
  +    fname = ap_server_root_relative(p, filename);
  +    if (!fname) {
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP|APLOG_CRIT, APR_EBADPATH, 
  +                     NULL, "Invalid PID file path %s, ignoring.", filename);
  +        return;
  +    }
   
  -    fname = ap_server_root_relative(p, fname);
       mypid = getpid();
       if (mypid != saved_pid
           && apr_stat(&finfo, fname, APR_FINFO_MTIME, p) == APR_SUCCESS) {
  
  
  
  1.85      +11 -4     httpd-2.0/server/mpm_common.c
  
  Index: mpm_common.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
  retrieving revision 1.84
  retrieving revision 1.85
  diff -u -r1.84 -r1.85
  --- mpm_common.c	13 Mar 2002 20:48:00 -0000	1.84
  +++ mpm_common.c	16 Mar 2002 18:26:58 -0000	1.85
  @@ -629,6 +629,7 @@
   const char *ap_mpm_set_coredumpdir(cmd_parms *cmd, void *dummy,
                                      const char *arg)
   {
  +    apr_status_t rv;
       apr_finfo_t finfo;
       const char *fname;
       const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
  @@ -637,12 +638,18 @@
       }
   
       fname = ap_server_root_relative(cmd->pool, arg);
  -    if ((apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool) != APR_SUCCESS)
  -        || (finfo.filetype != APR_DIR)) {
  +    if (!fname) {
  +        return apr_pstrcat(cmd->pool, "Invalid CoreDumpDirectory path ", 
  +                           arg, NULL);
  +    }
  +    if ((rv = apr_stat(&finfo, fname, APR_FINFO_TYPE, cmd->pool)) != APR_SUCCESS)
{
           return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
  -                           " does not exist or is not a directory", NULL);
  +                           " does not exist", NULL);
  +    }
  +    if (finfo.filetype != APR_DIR) {
  +        return apr_pstrcat(cmd->pool, "CoreDumpDirectory ", fname,
  +                           " is not a directory", NULL);
       }
  -
       apr_cpystrn(ap_coredump_dir, fname, sizeof(ap_coredump_dir));
       return NULL;
   }
  
  
  
  1.63      +6 -1      httpd-2.0/server/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- scoreboard.c	13 Mar 2002 20:48:00 -0000	1.62
  +++ scoreboard.c	16 Mar 2002 18:26:58 -0000	1.63
  @@ -213,7 +213,12 @@
       if (ap_scoreboard_fname) {
           /* make sure it's an absolute pathname */
           fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
  -
  +        if (!fname) {
  +            ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, NULL,
  +                         "Fatal error: Invalid Scoreboard path %s",
  +                         ap_scoreboard_fname);
  +            return APR_EBADPATH;
  +        }
           return create_namebased_scoreboard(global_pool, fname);
       }
       else { /* config didn't specify, we get to choose shmem type */
  
  
  

Mime
View raw message