From: Amos Jeffries Date: Fri, 10 Aug 2012 02:41:14 +0000 (+1200) Subject: Bug 3478: workaround: better default handling without -DSTRICT_ORIGINAL_DST X-Git-Tag: sourceformat-review-1~122 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=32c32865fedbcce65a1ada3be09bd9eff0281256;p=thirdparty%2Fsquid.git Bug 3478: workaround: better default handling without -DSTRICT_ORIGINAL_DST This extends the -DSTRICT_ORIGINAL_DST compile-time flag to include the logics listing ORIGINAL_DST as first preferred destination. Which makes ORIGINAL_DST a swap-in replacement for DIRECT and enables never_direct, always_direct, prefer_direct configuration to apply. --- diff --git a/src/cf.data.pre b/src/cf.data.pre index 6347c4b0e0..b268f5c61a 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -1920,7 +1920,7 @@ DOC_START * Reverse-proxy traffic is not checked at all. * Intercepted traffic which passes verification is handled - normally. + according to client_dst_passthru. * Intercepted requests which fail verification are sent to the client original destination instead of DIRECT. diff --git a/src/forward.cc b/src/forward.cc index d244da344b..c4b69950b8 100644 --- a/src/forward.cc +++ b/src/forward.cc @@ -127,6 +127,7 @@ void FwdState::start(Pointer aSelf) entry->registerAbort(FwdState::abort, this); +#if STRICT_ORIGINAL_DST // Bug 3243: CVE 2009-0801 // Bypass of browser same-origin access control in intercepted communication // To resolve this we must force DIRECT and only to the original client destination. @@ -134,17 +135,18 @@ void FwdState::start(Pointer aSelf) const bool useOriginalDst = Config.onoff.client_dst_passthru || (request && !request->flags.hostVerified); if (isIntercepted && useOriginalDst) { selectPeerForIntercepted(); -#if STRICT_ORIGINAL_DST // 3.2 does not suppro re-wrapping inside CONNECT. // our only alternative is to fake destination "found" and continue with the forwarding. startConnectionOrFail(); return; -#endif } +#endif + // do full route options selection peerSelect(&serverDestinations, request, entry, fwdPeerSelectionCompleteWrapper, this); } +#if STRICT_ORIGINAL_DST /// bypasses peerSelect() when dealing with intercepted requests void FwdState::selectPeerForIntercepted() @@ -172,6 +174,7 @@ FwdState::selectPeerForIntercepted() debugs(17, 3, HERE << "using client original destination: " << *p); serverDestinations.push_back(p); } +#endif void FwdState::completed() diff --git a/src/forward.h b/src/forward.h index fde9b75bfc..f2d0fbf2fc 100644 --- a/src/forward.h +++ b/src/forward.h @@ -74,7 +74,9 @@ private: FwdState(const Comm::ConnectionPointer &client, StoreEntry *, HttpRequest *, const AccessLogEntryPointer &alp); void start(Pointer aSelf); +#if STRICT_ORIGINAL_DST void selectPeerForIntercepted(); +#endif static void logReplyStatus(int tries, http_status status); void doneWithRetries(); void completed();