From ce96d9261e441c9ac99ed5f5281903e48589ef21 Mon Sep 17 00:00:00 2001 From: Brian Bockelman Date: Tue, 31 Oct 2017 15:59:33 -0500 Subject: [PATCH] Correct external handling logic. The test to see if there is an external plugin was inverted, meaning the wrong case in the conditional was always called. Additionally, this reverses the order of evaluation -- checking the (cheap, common) pointer value first, then invoking a function. --- src/XrdHttp/XrdHttpProtocol.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/XrdHttp/XrdHttpProtocol.cc b/src/XrdHttp/XrdHttpProtocol.cc index dff51ef7ca5..31cfc01cbd4 100644 --- a/src/XrdHttp/XrdHttpProtocol.cc +++ b/src/XrdHttp/XrdHttpProtocol.cc @@ -740,22 +740,20 @@ int XrdHttpProtocol::Process(XrdLink *lp) // We ignore the argument here // Now we have everything that is needed to try the login // Remember that if there is an exthandler then it has the responsibility // for authorization in the paths that it manages - if (FindMatchingExtHandler(CurrentReq)) { - if (!Bridge) { - if (SecEntity.name) - Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, SecEntity.name, "XrdHttp"); - else - Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, "unknown", "XrdHttp"); - - if (!Bridge) { - TRACEI(REQ, " Autorization failed."); - return -1; - } + if (!Bridge && !FindMatchingExtHandler(CurrentReq)) { + if (SecEntity.name) + Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, SecEntity.name, "XrdHttp"); + else + Bridge = XrdXrootd::Bridge::Login(&CurrentReq, Link, &SecEntity, "unknown", "XrdHttp"); - // Let the bridge process the login, and then reinvoke us - DoingLogin = true; - return 0; + if (!Bridge) { + TRACEI(REQ, " Authorization failed."); + return -1; } + + // Let the bridge process the login, and then reinvoke us + DoingLogin = true; + return 0; } // Compute and send the response. This may involve further reading from the socket