2 mod_usertrack fix from Manni Wood <manniwood planet-save.com>
4 http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=113269
6 --- httpd-2.0.48/modules/metadata/mod_usertrack.c.usertrack
7 +++ httpd-2.0.48/modules/metadata/mod_usertrack.c
9 * which has three subexpressions, $0..$2 */
12 +static void set_and_comp_regexp(cookie_dir_rec *dcfg,
14 + const char *cookie_name)
16 + /* The goal is to end up with this regexp,
17 + * ^cookie_name=([^;]+)|;[\t]+cookie_name=([^;]+)
18 + * with cookie_name obviously substituted either
19 + * with the real cookie name set by the user in httpd.conf, or with the
20 + * default COOKIE_NAME. */
21 + dcfg->regexp_string = apr_pstrcat(p, "^", cookie_name, "=([^;]+)|;[ \t]+", cookie_name, "=([^;]+)", NULL);
23 + dcfg->regexp = ap_pregcomp(p, dcfg->regexp_string, REG_EXTENDED);
26 static int spot_cookie(request_rec *r)
28 cookie_dir_rec *dcfg = ap_get_module_config(r->per_dir_config,
30 dcfg->cookie_domain = NULL;
31 dcfg->style = CT_UNSET;
34 + /* In case the user does not use the CookieName directive,
35 + * we need to compile the regexp for the default cookie name. */
36 + set_and_comp_regexp(dcfg, p, COOKIE_NAME);
43 cookie_dir_rec *dcfg = (cookie_dir_rec *) mconfig;
45 - /* The goal is to end up with this regexp,
46 - * ^cookie_name=([^;]+)|;[ \t]+cookie_name=([^;]+)
48 - * obviously substituted with the real cookie name set by the
49 - * user in httpd.conf. */
50 - dcfg->regexp_string = apr_pstrcat(cmd->pool, "^", name,
51 - "=([^;]+)|;[ \t]+", name,
54 dcfg->cookie_name = apr_pstrdup(cmd->pool, name);
56 - dcfg->regexp = ap_pregcomp(cmd->pool, dcfg->regexp_string, REG_EXTENDED);
57 + set_and_comp_regexp(dcfg, cmd->pool, name);
59 if (dcfg->regexp == NULL) {
60 return "Regular expression could not be compiled.";