[cpp-sp] branch main updated: SSPCPP-920 - External overrides break when custom handlers are used

Scott Cantor cantor.2 at osu.edu
Tue Mar 16 18:38:05 UTC 2021


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch main
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=6842ae2add14d9bb0c53861ebc1f837a144bd2c4

The following commit(s) were added to refs/heads/main by this push:
       new  6842ae2a  SSPCPP-920 - External overrides break when custom handlers are used
6842ae2a is described below

commit 6842ae2add14d9bb0c53861ebc1f837a144bd2c4
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Mar 16 14:37:28 2021 -0400

    SSPCPP-920 - External overrides break when custom handlers are used
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-920
    
    Handle multiple slashes without breaking standard case.
---
 shibsp/impl/XMLServiceProvider.cpp | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/shibsp/impl/XMLServiceProvider.cpp b/shibsp/impl/XMLServiceProvider.cpp
index 3f6d9302..9b58543c 100644
--- a/shibsp/impl/XMLServiceProvider.cpp
+++ b/shibsp/impl/XMLServiceProvider.cpp
@@ -883,23 +883,31 @@ Remoted* XMLConfig::lookupListener(const char* address) const
     if (i != m_listenerMap.end())
         return i->second.first ? i->second.first : i->second.second;
 
+    locker.release()->unlock();   // free up the listener map
+
+    // Start iterating at slash boundaries.
+    const char* slash = strstr(address, "/");
+    while (slash) {
+        string appId(address, slash - address);
+        if (getApplication(appId.c_str())) {
+            SharedLock sublocker(m_listenerLock, true); // relock and check again
+            i = m_listenerMap.find(address);
+            if (i != m_listenerMap.end())
+                return i->second.first ? i->second.first : i->second.second;
+        }
+        slash = strstr(slash + 1, "/");
+    }
+
+    // Try a search based on the colons, which handles no embedded slashes in the address.
     const char* colons = strstr(address, "::");
     if (colons) {
         string appId(address, colons - address);
-        locker.release()->unlock();   // free up the listener map
-        if (!getApplication(appId.c_str())) {
-            // Try a second search breaking on slash instead.
-            // This accommodates overrides with their own handlers.
-            const char* slash = strstr(address, "/");
-            if (slash) {
-                appId = string(address, slash - address);
-                getApplication(appId.c_str());
-            }
+        if (getApplication(appId.c_str())) {
+            SharedLock sublocker(m_listenerLock, true); // relock and check again
+            i = m_listenerMap.find(address);
+            if (i != m_listenerMap.end())
+                return i->second.first ? i->second.first : i->second.second;
         }
-        SharedLock sublocker(m_listenerLock, true); // relock and check again
-        i = m_listenerMap.find(address);
-        if (i != m_listenerMap.end())
-            return i->second.first ? i->second.first : i->second.second;
     }
     return nullptr;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list