httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: httpd-2.0/modules/metadata mod_usertrack.c
Date Mon, 08 Mar 2004 23:27:31 GMT
jerenkrantz    2004/03/08 15:27:31

  Modified:    .        CHANGES
               modules/metadata mod_usertrack.c
  Log:
  Fix bug in mod_usertrack when no CookieName is set.
  
  PR: 24483
  Submitted by:	Manni Wood <manniwood planet-save.com>
  Reviewed by:	Cliff Woolley, Jim Jagielski
  
  Revision  Changes    Path
  1.1417    +3 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1416
  retrieving revision 1.1417
  diff -u -u -r1.1416 -r1.1417
  --- CHANGES	7 Mar 2004 22:07:55 -0000	1.1416
  +++ CHANGES	8 Mar 2004 23:27:31 -0000	1.1417
  @@ -2,6 +2,9 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) Fix bug in mod_usertrack when no CookieName is set.  PR 24483.
  +     [Manni Wood <manniwood planet-save.com>]
  +
     *) Remove compile-time length limit on request strings. Length is
        now enforced solely with the LimitRequestLine config directive.
        [Paul J. Reder]
  
  
  
  1.49      +21 -10    httpd-2.0/modules/metadata/mod_usertrack.c
  
  Index: mod_usertrack.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_usertrack.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -u -r1.48 -r1.49
  --- mod_usertrack.c	9 Feb 2004 20:29:21 -0000	1.48
  +++ mod_usertrack.c	8 Mar 2004 23:27:31 -0000	1.49
  @@ -156,6 +156,20 @@
    * which has three subexpressions, $0..$2 */
   #define NUM_SUBS 3
   
  +static void set_and_comp_regexp(cookie_dir_rec *dcfg,
  +                                apr_pool_t *p,
  +                                const char *cookie_name)
  +{
  +    /* The goal is to end up with this regexp,
  +     * ^cookie_name=([^;]+)|;[\t]+cookie_name=([^;]+)
  +     * with cookie_name obviously substituted either
  +     * with the real cookie name set by the user in httpd.conf, or with the
  +     * default COOKIE_NAME. */
  +    dcfg->regexp_string = apr_pstrcat(p, "^", cookie_name, "=([^;]+)|;[ \t]+", cookie_name,
"=([^;]+)", NULL);
  +
  +    dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
  +}
  +
   static int spot_cookie(request_rec *r)
   {
       cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
  @@ -214,6 +228,11 @@
       dcfg->cookie_domain = NULL;
       dcfg->style = CT_UNSET;
       dcfg->enabled = 0;
  +
  +    /* In case the user does not use the CookieName directive,
  +     * we need to compile the regexp for the default cookie name. */
  +    set_and_comp_regexp(dcfg, p, COOKIE_NAME);
  +
       return dcfg;
   }
   
  @@ -299,18 +318,10 @@
   {
       cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig;
   
  -    /* The goal is to end up with this regexp,
  -     * ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)
  -     * with cookie_name
  -     * obviously substituted with the real cookie name set by the
  -     * user in httpd.conf. */
  -    dcfg->regexp_string = apr_pstrcat(cmd->pool, "^", name,
  -                                      "=([^;]+)|;[ \t]+", name,
  -                                      "=([^;]+)", NULL);
  -
       dcfg->cookie_name = apr_pstrdup(cmd->pool, name);
   
  -    dcfg->regexp = ap_pregcomp(cmd->pool, dcfg->regexp_string, REG_EXTENDED);
  +    set_and_comp_regexp(dcfg, cmd->pool, name);
  +
       if (dcfg->regexp == NULL) {
           return "Regular expression could not be compiled.";
       }
  
  
  

Mime
View raw message