[shibboleth-sp2] 21/100: Needed lock around svcfd_create call, which manipulates ONC globals.

Ferenc Wágner wferi-guest at moszumanska.debian.org
Tue Jan 26 21:29:14 UTC 2016


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

wferi-guest pushed a commit to annotated tag 1.2.1
in repository shibboleth-sp2.

commit 050c5c6dac5bd2a6828bb6e022a86e7dd0d6d35d
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Wed Oct 6 22:22:53 2004 +0000

    Needed lock around svcfd_create call, which manipulates ONC globals.
---
 shar/shar-utils.cpp | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/shar/shar-utils.cpp b/shar/shar-utils.cpp
index 1a15d74..e5b55d6 100644
--- a/shar/shar-utils.cpp
+++ b/shar/shar-utils.cpp
@@ -117,18 +117,23 @@ void SharChild::run()
     FD_SET(sock, &readfds);
     tv.tv_sec = 1;
 
-    switch (select (sock+1, &readfds, 0, 0, &tv)) {
+    switch (select(sock+1, &readfds, 0, 0, &tv)) {
 
+#ifdef WIN32
+    case SOCKET_ERROR:
+#else
     case -1:
+#endif
       if (errno == EINTR) continue;
       SHARUtils::log_error();
+      Category::getInstance("SHAR.SharChild").error("select() on incoming request socket returned error");
       return;
 
     case 0:
       break;
 
     default:
-      svc_getreqset (&readfds);
+      svc_getreqset(&readfds);
     }
   }
 
@@ -157,9 +162,17 @@ void SHARUtils::log_error()
 int SHARUtils::shar_create_svc(IListener::ShibSocket& sock, const Iterator<ShibRPCProtocols>& protos)
 {
   NDC ndc("shar_create_svc");
-
-  /* Wrap an RPC Service around the new connection socket */
+  Category::getInstance("SHAR.SHARUtils").debug("creating RPC listener around socket (%u)",sock);
+
+  /*
+   Wrap an RPC Service around the new connection socket.
+   This appears to be one of the key critical sections left unprotected in the ONC code.
+   It writes to global variables and actually does a malloc/calloc of one of them
+   in-line inside the xprt_register code.
+  */
+  child_lock->lock();
   SVCXPRT* svc = svcfd_create (sock, 0, 0);
+  child_lock->unlock();
   if (!svc) {
     Category::getInstance("SHAR.SHARUtils").error("cannot create RPC listener");
     return -1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-shibboleth/shibboleth-sp2.git



More information about the Pkg-shibboleth-devel mailing list