From: Mladen Turk Date: Fri, 20 Jul 2007 08:37:59 +0000 (+0000) Subject: Backport accepted patch from trunk. X-Git-Tag: 2.2.5~129 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f080deb9432624fba1321a094a5f208ebc789b00;p=thirdparty%2Fapache%2Fhttpd.git Backport accepted patch from trunk. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@557926 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 86918701f94..b5e6d1d5f24 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,9 @@ -*- coding: utf-8 -*- Changes with Apache 2.2.5 + *) mod_proxy: Fix the 503 returned when session route does + not match any of the balancer members. [Mladen Turk] + *) SECURITY: CVE-2007-1863 (cve.mitre.org) mod_cache: Prevent a segmentation fault if attributes are listed in a Cache-Control header without any value. diff --git a/STATUS b/STATUS index d926a891ee3..1614c3dc158 100644 --- a/STATUS +++ b/STATUS @@ -89,12 +89,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: http://issues.apache.org/bugzilla/attachment.cgi?id=20480 +1: jfclere, mturk, rpluem - * mod_proxy: Fix the 503 returned when session route does - not match any of the balancer members. - Trunk version of patch: - http://svn.apache.org/viewvc?view=rev&revision=556931 - +1: mturk, rpluem, jfclere - PATCHES PROPOSED TO BACKPORT FROM TRUNK: * ApacheMonitor: Fix Windows Vista detection. diff --git a/modules/proxy/mod_proxy_balancer.c b/modules/proxy/mod_proxy_balancer.c index 5b376cbd762..d02749b1ab3 100644 --- a/modules/proxy/mod_proxy_balancer.c +++ b/modules/proxy/mod_proxy_balancer.c @@ -421,15 +421,32 @@ static int proxy_balancer_pre_request(proxy_worker **worker, *worker = runtime; } else if (route && (*balancer)->sticky_force) { - ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, - "proxy: BALANCER: (%s). All workers are in error state for route (%s)", - (*balancer)->name, route); - if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, - "proxy: BALANCER: (%s). Unlock failed for pre_request", - (*balancer)->name); + int i, member_of = 0; + proxy_worker *workers; + /* + * We have a route provided that doesn't match the + * balancer name. See if the provider route is the + * member of the same balancer in which case return 503 + */ + workers = (proxy_worker *)(*balancer)->workers->elts; + for (i = 0; i < (*balancer)->workers->nelts; i++) { + if (*(workers->s->route) && strcmp(workers->s->route, route) == 0) { + member_of = 1; + break; + } + workers++; + } + if (member_of) { + ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, + "proxy: BALANCER: (%s). All workers are in error state for route (%s)", + (*balancer)->name, route); + if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server, + "proxy: BALANCER: (%s). Unlock failed for pre_request", + (*balancer)->name); + } + return HTTP_SERVICE_UNAVAILABLE; } - return HTTP_SERVICE_UNAVAILABLE; } if ((rv = PROXY_THREAD_UNLOCK(*balancer)) != APR_SUCCESS) {