Loading CHANGES +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] *) mod_rewrite: Removed the MaxRedirects option in favor of the core LimitInternalRecursion directive. [André Malo] *) SECURITY: CAN-2004-0885 (cve.mitre.org) mod_ssl: Fix a bug which allowed an SSLCipherSuite setting to be bypassed during an SSL renegotiation. PR 31505. Loading modules/mappers/mod_rewrite.c +6 −90 Original line number Diff line number Diff line Loading @@ -174,9 +174,6 @@ /* XXX: not used at all. We should do a check somewhere and/or cut the cookie */ #define MAX_COOKIE_LEN 4096 /* default maximum number of internal redirects */ #define REWRITE_REDIRECT_LIMIT 10 /* max line length (incl.\n) in text rewrite maps */ #ifndef REWRITE_MAX_TXT_MAP_LINE #define REWRITE_MAX_TXT_MAP_LINE 1024 Loading Loading @@ -285,7 +282,6 @@ typedef struct { apr_array_header_t *rewriteconds; /* the RewriteCond entries (temp.) */ apr_array_header_t *rewriterules; /* the RewriteRule entries */ server_rec *server; /* the corresponding server indicator */ int redirect_limit; /* max number of internal redirects */ } rewrite_server_conf; typedef struct { Loading @@ -295,14 +291,8 @@ typedef struct { apr_array_header_t *rewriterules; /* the RewriteRule entries */ char *directory; /* the directory where it applies */ const char *baseurl; /* the base-URL where it applies */ int redirect_limit; /* max. number of internal redirects */ } rewrite_perdir_conf; typedef struct { int redirects; /* current number of redirects */ int redirect_limit; /* maximum number of redirects */ } rewrite_request_conf; /* the (per-child) cache structures. */ typedef struct cache { Loading Loading @@ -2586,7 +2576,6 @@ static void *config_server_create(apr_pool_t *p, server_rec *s) a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry)); a->server = s; a->redirect_limit = 0; /* unset (use default) */ return (void *)a; } Loading @@ -2603,9 +2592,6 @@ static void *config_server_merge(apr_pool_t *p, void *basev, void *overridesv) a->state = overrides->state; a->options = overrides->options; a->server = overrides->server; a->redirect_limit = overrides->redirect_limit ? overrides->redirect_limit : base->redirect_limit; if (a->options & OPTION_INHERIT) { /* Loading Loading @@ -2659,7 +2645,6 @@ static void *config_perdir_create(apr_pool_t *p, char *path) a->baseurl = NULL; a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry)); a->redirect_limit = 0; /* unset (use server config) */ if (path == NULL) { a->directory = NULL; Loading Loading @@ -2690,9 +2675,6 @@ static void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv) a->options = overrides->options; a->directory = overrides->directory; a->baseurl = overrides->baseurl; a->redirect_limit = overrides->redirect_limit ? overrides->redirect_limit : base->redirect_limit; if (a->options & OPTION_INHERIT) { a->rewriteconds = apr_array_append(p, overrides->rewriteconds, Loading Loading @@ -2729,7 +2711,7 @@ static const char *cmd_rewriteengine(cmd_parms *cmd, static const char *cmd_rewriteoptions(cmd_parms *cmd, void *in_dconf, const char *option) { int options = 0, limit = 0; int options = 0; char *w; while (*option) { Loading @@ -2739,15 +2721,11 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd, options |= OPTION_INHERIT; } else if (!strncasecmp(w, "MaxRedirects=", 13)) { limit = atoi(&w[13]); if (limit <= 0) { return "RewriteOptions: MaxRedirects takes a number greater " "than zero."; } } else if (!strcasecmp(w, "MaxRedirects")) { /* be nice */ return "RewriteOptions: MaxRedirects has the format MaxRedirects" "=n."; ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, "RewriteOptions: MaxRedirects option has been " "removed in favor of the global " "LimitInternalRecursion directive and will be " "ignored."); } else { return apr_pstrcat(cmd->pool, "RewriteOptions: unknown option '", Loading @@ -2762,13 +2740,11 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd, &rewrite_module); conf->options |= options; conf->redirect_limit = limit; } else { /* is per-directory command */ rewrite_perdir_conf *conf = in_dconf; conf->options |= options; conf->redirect_limit = limit; } return NULL; Loading Loading @@ -4722,57 +4698,6 @@ static int hook_mimetype(request_rec *r) return OK; } /* check whether redirect limit is reached */ static int is_redirect_limit_exceeded(request_rec *r) { request_rec *top = r; rewrite_request_conf *reqc; rewrite_perdir_conf *dconf; /* we store it in the top request */ while (top->main) { top = top->main; } while (top->prev) { top = top->prev; } /* fetch our config */ reqc = (rewrite_request_conf *) ap_get_module_config(top->request_config, &rewrite_module); /* no config there? create one. */ if (!reqc) { rewrite_server_conf *sconf; reqc = apr_palloc(top->pool, sizeof(rewrite_request_conf)); sconf = ap_get_module_config(r->server->module_config, &rewrite_module); reqc->redirects = 0; reqc->redirect_limit = sconf->redirect_limit ? sconf->redirect_limit : REWRITE_REDIRECT_LIMIT; /* associate it with this request */ ap_set_module_config(top->request_config, &rewrite_module, reqc); } /* allow to change the limit during redirects. */ dconf = (rewrite_perdir_conf *)ap_get_module_config(r->per_dir_config, &rewrite_module); /* 0 == unset; take server conf ... */ if (dconf->redirect_limit) { reqc->redirect_limit = dconf->redirect_limit; } ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "mod_rewrite's internal redirect status: %d/%d.", reqc->redirects, reqc->redirect_limit); /* and now give the caller a hint */ return (reqc->redirects++ >= reqc->redirect_limit); } /* * "content" handler for internal redirects Loading @@ -4788,15 +4713,6 @@ static int handler_redirect(request_rec *r) return DECLINED; } if (is_redirect_limit_exceeded(r)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mod_rewrite: maximum number of internal redirects " "reached. Assuming configuration error. Use " "'RewriteOptions MaxRedirects' to increase the limit " "if neccessary."); return HTTP_INTERNAL_SERVER_ERROR; } /* now do the internal redirect */ ap_internal_redirect(apr_pstrcat(r->pool, r->filename+9, r->args ? "?" : NULL, r->args, NULL), r); Loading Loading
CHANGES +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] *) mod_rewrite: Removed the MaxRedirects option in favor of the core LimitInternalRecursion directive. [André Malo] *) SECURITY: CAN-2004-0885 (cve.mitre.org) mod_ssl: Fix a bug which allowed an SSLCipherSuite setting to be bypassed during an SSL renegotiation. PR 31505. Loading
modules/mappers/mod_rewrite.c +6 −90 Original line number Diff line number Diff line Loading @@ -174,9 +174,6 @@ /* XXX: not used at all. We should do a check somewhere and/or cut the cookie */ #define MAX_COOKIE_LEN 4096 /* default maximum number of internal redirects */ #define REWRITE_REDIRECT_LIMIT 10 /* max line length (incl.\n) in text rewrite maps */ #ifndef REWRITE_MAX_TXT_MAP_LINE #define REWRITE_MAX_TXT_MAP_LINE 1024 Loading Loading @@ -285,7 +282,6 @@ typedef struct { apr_array_header_t *rewriteconds; /* the RewriteCond entries (temp.) */ apr_array_header_t *rewriterules; /* the RewriteRule entries */ server_rec *server; /* the corresponding server indicator */ int redirect_limit; /* max number of internal redirects */ } rewrite_server_conf; typedef struct { Loading @@ -295,14 +291,8 @@ typedef struct { apr_array_header_t *rewriterules; /* the RewriteRule entries */ char *directory; /* the directory where it applies */ const char *baseurl; /* the base-URL where it applies */ int redirect_limit; /* max. number of internal redirects */ } rewrite_perdir_conf; typedef struct { int redirects; /* current number of redirects */ int redirect_limit; /* maximum number of redirects */ } rewrite_request_conf; /* the (per-child) cache structures. */ typedef struct cache { Loading Loading @@ -2586,7 +2576,6 @@ static void *config_server_create(apr_pool_t *p, server_rec *s) a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry)); a->server = s; a->redirect_limit = 0; /* unset (use default) */ return (void *)a; } Loading @@ -2603,9 +2592,6 @@ static void *config_server_merge(apr_pool_t *p, void *basev, void *overridesv) a->state = overrides->state; a->options = overrides->options; a->server = overrides->server; a->redirect_limit = overrides->redirect_limit ? overrides->redirect_limit : base->redirect_limit; if (a->options & OPTION_INHERIT) { /* Loading Loading @@ -2659,7 +2645,6 @@ static void *config_perdir_create(apr_pool_t *p, char *path) a->baseurl = NULL; a->rewriteconds = apr_array_make(p, 2, sizeof(rewritecond_entry)); a->rewriterules = apr_array_make(p, 2, sizeof(rewriterule_entry)); a->redirect_limit = 0; /* unset (use server config) */ if (path == NULL) { a->directory = NULL; Loading Loading @@ -2690,9 +2675,6 @@ static void *config_perdir_merge(apr_pool_t *p, void *basev, void *overridesv) a->options = overrides->options; a->directory = overrides->directory; a->baseurl = overrides->baseurl; a->redirect_limit = overrides->redirect_limit ? overrides->redirect_limit : base->redirect_limit; if (a->options & OPTION_INHERIT) { a->rewriteconds = apr_array_append(p, overrides->rewriteconds, Loading Loading @@ -2729,7 +2711,7 @@ static const char *cmd_rewriteengine(cmd_parms *cmd, static const char *cmd_rewriteoptions(cmd_parms *cmd, void *in_dconf, const char *option) { int options = 0, limit = 0; int options = 0; char *w; while (*option) { Loading @@ -2739,15 +2721,11 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd, options |= OPTION_INHERIT; } else if (!strncasecmp(w, "MaxRedirects=", 13)) { limit = atoi(&w[13]); if (limit <= 0) { return "RewriteOptions: MaxRedirects takes a number greater " "than zero."; } } else if (!strcasecmp(w, "MaxRedirects")) { /* be nice */ return "RewriteOptions: MaxRedirects has the format MaxRedirects" "=n."; ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, "RewriteOptions: MaxRedirects option has been " "removed in favor of the global " "LimitInternalRecursion directive and will be " "ignored."); } else { return apr_pstrcat(cmd->pool, "RewriteOptions: unknown option '", Loading @@ -2762,13 +2740,11 @@ static const char *cmd_rewriteoptions(cmd_parms *cmd, &rewrite_module); conf->options |= options; conf->redirect_limit = limit; } else { /* is per-directory command */ rewrite_perdir_conf *conf = in_dconf; conf->options |= options; conf->redirect_limit = limit; } return NULL; Loading Loading @@ -4722,57 +4698,6 @@ static int hook_mimetype(request_rec *r) return OK; } /* check whether redirect limit is reached */ static int is_redirect_limit_exceeded(request_rec *r) { request_rec *top = r; rewrite_request_conf *reqc; rewrite_perdir_conf *dconf; /* we store it in the top request */ while (top->main) { top = top->main; } while (top->prev) { top = top->prev; } /* fetch our config */ reqc = (rewrite_request_conf *) ap_get_module_config(top->request_config, &rewrite_module); /* no config there? create one. */ if (!reqc) { rewrite_server_conf *sconf; reqc = apr_palloc(top->pool, sizeof(rewrite_request_conf)); sconf = ap_get_module_config(r->server->module_config, &rewrite_module); reqc->redirects = 0; reqc->redirect_limit = sconf->redirect_limit ? sconf->redirect_limit : REWRITE_REDIRECT_LIMIT; /* associate it with this request */ ap_set_module_config(top->request_config, &rewrite_module, reqc); } /* allow to change the limit during redirects. */ dconf = (rewrite_perdir_conf *)ap_get_module_config(r->per_dir_config, &rewrite_module); /* 0 == unset; take server conf ... */ if (dconf->redirect_limit) { reqc->redirect_limit = dconf->redirect_limit; } ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "mod_rewrite's internal redirect status: %d/%d.", reqc->redirects, reqc->redirect_limit); /* and now give the caller a hint */ return (reqc->redirects++ >= reqc->redirect_limit); } /* * "content" handler for internal redirects Loading @@ -4788,15 +4713,6 @@ static int handler_redirect(request_rec *r) return DECLINED; } if (is_redirect_limit_exceeded(r)) { ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "mod_rewrite: maximum number of internal redirects " "reached. Assuming configuration error. Use " "'RewriteOptions MaxRedirects' to increase the limit " "if neccessary."); return HTTP_INTERNAL_SERVER_ERROR; } /* now do the internal redirect */ ap_internal_redirect(apr_pstrcat(r->pool, r->filename+9, r->args ? "?" : NULL, r->args, NULL), r); Loading