[shibboleth-sp2] 54/100: Work around broken svc_destroy on Mac

Ferenc Wágner wferi-guest at moszumanska.debian.org
Tue Jan 26 21:29:17 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 309a0e0bc0474429bc4b60cb776d4e84b64f14a5
Author: Scott Cantor <cantor.2 at osu.edu>
Date:   Tue Oct 19 02:56:13 2004 +0000

    Work around broken svc_destroy on Mac
---
 shar/shar-utils.cpp | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/shar/shar-utils.cpp b/shar/shar-utils.cpp
index 3b6371b..32bb5d9 100644
--- a/shar/shar-utils.cpp
+++ b/shar/shar-utils.cpp
@@ -31,10 +31,21 @@
 #include <shib/shib-threads.h>
 #include <log4cpp/Category.hh>
 
+// Deal with inadequate Sun RPC libraries
+
 #if !HAVE_DECL_SVCFD_CREATE
   extern "C" SVCXPRT* svcfd_create(int, u_int, u_int);
 #endif
 
+#ifndef HAVE_WORKING_SVC_DESTROY
+struct tcp_conn {  /* kept in xprt->xp_p1 */
+    enum xprt_stat strm_stat;
+    u_long x_id;
+    XDR xdrs;
+    char verf_body[MAX_AUTH_BYTES];
+};
+#endif
+
 using namespace std;
 using namespace saml;
 using namespace shibboleth;
@@ -144,7 +155,23 @@ bool SharChild::svc_create()
   while (i.hasNext()) {
     const ShibRPCProtocols& p=i.next();
     if (!svc_register (transp, p.prog, p.vers, p.dispatch, 0)) {
+#ifdef HAVE_WORKING_SVC_DESTROY
       svc_destroy(transp);
+#else
+      /* we have to inline svc_destroy because we can't pass in the xprt variable */
+      struct tcp_conn *cd = (struct tcp_conn *)transp->xp_p1;
+      xprt_unregister(transp);
+      close(transp->xp_sock);
+      if (transp->xp_port != 0) {
+        /* a rendezvouser socket */
+        transp->xp_port = 0;
+      } else {
+        /* an actual connection socket */
+        XDR_DESTROY(&(cd->xdrs));
+      }
+      mem_free((caddr_t)cd, sizeof(struct tcp_conn));
+      mem_free((caddr_t)transp, sizeof(SVCXPRT));
+#endif
       NDC ndc("svc_create");
       Category::getInstance("SHAR.SharChild").error("cannot register RPC program");
       return false;

-- 
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