httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/server core.c
Date Wed, 24 Mar 2004 02:53:36 GMT
trawick     2004/03/23 18:53:35

  Modified:    .        CHANGES
               include  http_core.h
               server   core.c
  Log:
  Fix memory corruption problem with ap_custom_response() function.
  The core per-dir config would later point to request pool data
  that would be reused for different purposes on different requests.
  
  This is based on an old 1.3 patch submitted by Will Lowe.
  It needs a minor tweak before committing to 1.3, but he had
  it pretty darn close.
  
  Revision  Changes    Path
  1.1433    +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1432
  retrieving revision 1.1433
  diff -u -r1.1432 -r1.1433
  --- CHANGES	23 Mar 2004 13:57:48 -0000	1.1432
  +++ CHANGES	24 Mar 2004 02:53:34 -0000	1.1433
  @@ -2,6 +2,11 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Fix memory corruption problem with ap_custom_response() function.
  +     The core per-dir config would later point to request pool data
  +     that would be reused for different purposes on different requests.
  +     [Jeff Trawick, based on an old 1.3 patch submitted by Will Lowe]
  +
     *) work around MSIE Digest auth bug - if AuthDigestEnableQueryStringHack
        is set in r->subprocess_env allow mismatched query strings to pass.
        PR 27758.  [Paul Querna <chip force-elite.com>, Geoffrey Young]
  
  
  
  1.82      +9 -1      httpd-2.0/include/http_core.h
  
  Index: http_core.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_core.h,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- http_core.h	14 Mar 2004 16:24:55 -0000	1.81
  +++ http_core.h	24 Mar 2004 02:53:35 -0000	1.82
  @@ -324,6 +324,13 @@
        * won't actually be delivered as the response for the non-GET method.
        */
       int deliver_script;
  +
  +    /* Custom response strings registered via ap_custom_response(),
  +     * or NULL; check per-dir config if nothing found here
  +     */
  +    char **response_code_strings; /* from ap_custom_response(), not from
  +                                   * ErrorDocument
  +                                   */
   } core_request_config;
   
   /* Standard entries that are guaranteed to be accessible via
  @@ -426,7 +433,8 @@
        * This lets us do quick merges in merge_core_dir_configs().
        */
     
  -    char **response_code_strings;
  +    char **response_code_strings; /* from ErrorDocument, not from
  +                                   * ap_custom_response() */
   
       /* Hostname resolution etc */
   #define HOSTNAME_LOOKUP_OFF	0
  
  
  
  1.268     +19 -9     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.267
  retrieving revision 1.268
  diff -u -r1.267 -r1.268
  --- core.c	15 Mar 2004 23:08:41 -0000	1.267
  +++ core.c	24 Mar 2004 02:53:35 -0000	1.268
  @@ -678,16 +678,26 @@
   
   char *ap_response_code_string(request_rec *r, int error_index)
   {
  -    core_dir_config *conf;
  +    core_dir_config *dirconf;
  +    core_request_config *reqconf;
   
  -    conf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
  -                                                   &core_module);
  +    /* check for string registered via ap_custom_response() first */
  +    reqconf = (core_request_config *)ap_get_module_config(r->request_config,
  +                                                          &core_module);
  +    if (reqconf->response_code_strings != NULL &&
  +        reqconf->response_code_strings[error_index] != NULL) {
  +        return reqconf->response_code_strings[error_index];
  +    }
   
  -    if (conf->response_code_strings == NULL) {
  -        return NULL;
  +    /* check for string specified via ErrorDocument */
  +    dirconf = (core_dir_config *)ap_get_module_config(r->per_dir_config,
  +                                                      &core_module);
  +
  +    if (dirconf->response_code_strings == NULL) {
  +	return NULL;
       }
   
  -    return conf->response_code_strings[error_index];
  +    return dirconf->response_code_strings[error_index];
   }
   
   
  @@ -1100,11 +1110,11 @@
   AP_DECLARE(void) ap_custom_response(request_rec *r, int status,
                                       const char *string)
   {
  -    core_dir_config *conf =
  -        ap_get_module_config(r->per_dir_config, &core_module);
  +    core_request_config *conf =
  +        ap_get_module_config(r->request_config, &core_module);
       int idx;
   
  -    if(conf->response_code_strings == NULL) {
  +    if (conf->response_code_strings == NULL) {
           conf->response_code_strings =
               apr_pcalloc(r->pool,
                           sizeof(*conf->response_code_strings) * RESPONSE_CODES);
  
  
  

Mime
View raw message