[cpp-sp] branch main updated: SSPCPP-908 - Broken sock got reused in mod_shib with TCPListener

Scott Cantor cantor.2 at osu.edu
Thu Dec 3 17:20:23 UTC 2020


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=70398fb557cb51aa2c7002c99dcb0aa5f0ef4790

The following commit(s) were added to refs/heads/main by this push:
       new  70398fb5  SSPCPP-908 - Broken sock got reused in mod_shib with TCPListener
70398fb5 is described below

commit 70398fb557cb51aa2c7002c99dcb0aa5f0ef4790
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Dec 3 12:19:57 2020 -0500

    SSPCPP-908 - Broken sock got reused in mod_shib with TCPListener
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-908
---
 shibsp/remoting/impl/SocketListener.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/shibsp/remoting/impl/SocketListener.cpp b/shibsp/remoting/impl/SocketListener.cpp
index bc8bc565..37c5c884 100644
--- a/shibsp/remoting/impl/SocketListener.cpp
+++ b/shibsp/remoting/impl/SocketListener.cpp
@@ -65,7 +65,7 @@ namespace shibsp {
         SocketPool(Category& log, const SocketListener* listener)
             : m_log(log), m_listener(listener), m_lock(Mutex::create()) {}
         ~SocketPool();
-        SocketListener::ShibSocket get();
+        SocketListener::ShibSocket get(bool newSocket=false);
         void put(SocketListener::ShibSocket s);
 
     private:
@@ -150,8 +150,11 @@ SocketPool::~SocketPool()
     }
 }
 
-SocketListener::ShibSocket SocketPool::get()
+SocketListener::ShibSocket SocketPool::get(bool newSocket)
 {
+    if (newSocket)
+        return connect();
+
     m_lock->lock();
     if (m_pool.empty()) {
         m_lock->unlock();
@@ -314,7 +317,8 @@ DDF SocketListener::send(const DDF& in)
     int retry = 1;
     SocketListener::ShibSocket sock;
     while (retry >= 0) {
-        sock = m_socketpool->get();
+        // On second time in, just get a new socket.
+        sock = m_socketpool->get(retry == 0);
 
         int outlen = ostr.length();
         len = htonl(outlen);

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


More information about the commits mailing list