[cpp-sp COMMIT] in /branches/REL_2: apache/mod_shib.cpp shibsp/AbstractSPRequest.cpp shibsp/GSSRequest.h shibsp/handl...

noreply at shibboleth.net noreply at shibboleth.net
Tue Apr 3 22:37:50 BST 2012


Author: scantor
Date: Tue Apr  3 22:37:50 2012
New Revision: 3609

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3609&view=rev
Log:
Add name-based API to GSSRequest

Modified:
    branches/REL_2/apache/mod_shib.cpp
    branches/REL_2/shibsp/AbstractSPRequest.cpp
    branches/REL_2/shibsp/GSSRequest.h
    branches/REL_2/shibsp/handler/impl/RemotedHandler.cpp

Modified: branches/REL_2/apache/mod_shib.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/apache/mod_shib.cpp?rev=3609&r1=3608&r2=3609&view=diff
==============================================================================
--- branches/REL_2/apache/mod_shib.cpp (original)
+++ branches/REL_2/apache/mod_shib.cpp Tue Apr  3 22:37:50 2012
@@ -19,7 +19,7 @@
  */
 
 /**
- * mod_apache.cpp
+ * mod_shib.cpp
  *
  * Apache module implementation.
  */
@@ -324,6 +324,9 @@
   mutable bool m_gotBody,m_firsttime;
   mutable vector<string> m_certs;
   set<string> m_allhttp;
+#if defined(SHIBSP_HAVE_GSSAPI) && !defined(SHIB_APACHE_13)
+  mutable gss_name_t m_gssname;
+#endif
 
 public:
   bool m_handler;
@@ -333,9 +336,20 @@
   shib_request_config* m_rc;
 
   ShibTargetApache(request_rec* req) : AbstractSPRequest(SHIBSP_LOGCAT".Apache"),
-        m_gotBody(false),m_firsttime(true), m_handler(false), m_req(req), m_dc(nullptr), m_sc(nullptr), m_rc(nullptr) {
-  }
-  virtual ~ShibTargetApache() {}
+        m_gotBody(false),m_firsttime(true),
+#if defined(SHIBSP_HAVE_GSSAPI) && !defined(SHIB_APACHE_13)
+        m_gssname(GSS_C_NO_NAME),
+#endif
+        m_handler(false), m_req(req), m_dc(nullptr), m_sc(nullptr), m_rc(nullptr) {
+  }
+  virtual ~ShibTargetApache() {
+#if defined(SHIBSP_HAVE_GSSAPI) && !defined(SHIB_APACHE_13)
+    if (m_gssname != GSS_C_NO_NAME) {
+        OM_uint32 minor;
+        gss_release_name(&minor, &m_gssname);
+    }
+#endif
+  }
 
   bool isInitialized() const {
       return (m_sc != nullptr);
@@ -634,7 +648,19 @@
     apr_pool_userdata_get((void**)&ctx, g_szGSSContextKey, m_req->pool);
     return ctx;
   }
-#endif
+  gss_name_t getGSSName() const {
+      if (m_gssname == GSS_C_NO_NAME) {
+          gss_ctx_id_t ctx = getGSSContext();
+          if (ctx != GSS_C_NO_CONTEXT) {
+              OM_uint32 minor;
+              OM_uint32 major = gss_inquire_context(&minor, ctx, &m_gssname, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
+              if (major != GSS_S_COMPLETE)
+                  m_gssname = GSS_C_NO_NAME;
+          }
+      }
+      return m_gssname;
+  }
+  #endif
 };
 
 /********************************************************************************/

Modified: branches/REL_2/shibsp/AbstractSPRequest.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/AbstractSPRequest.cpp?rev=3609&r1=3608&r2=3609&view=diff
==============================================================================
--- branches/REL_2/shibsp/AbstractSPRequest.cpp (original)
+++ branches/REL_2/shibsp/AbstractSPRequest.cpp Tue Apr  3 22:37:50 2012
@@ -64,6 +64,11 @@
 
 GSSRequest::~GSSRequest()
 {
+}
+
+gss_name_t GSSRequest::getGSSName() const
+{
+    return GSS_C_NO_NAME;
 }
 #endif
 

Modified: branches/REL_2/shibsp/GSSRequest.h
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/GSSRequest.h?rev=3609&r1=3608&r2=3609&view=diff
==============================================================================
--- branches/REL_2/shibsp/GSSRequest.h (original)
+++ branches/REL_2/shibsp/GSSRequest.h Tue Apr  3 22:37:50 2012
@@ -58,6 +58,14 @@
          * @return  a GSS-API context handle, or GSS_C_NO_CONTEXT
          */
         virtual gss_ctx_id_t getGSSContext() const=0;
+
+        /**
+         * Returns the GSS-API initiator name established for this request, or
+         * GSS_C_NO_NAME if none is available.
+         *
+         * @return  a GSS-API name, or GSS_C_NO_NAME
+         */
+        virtual gss_name_t getGSSName() const;
     };
 };
 

Modified: branches/REL_2/shibsp/handler/impl/RemotedHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/RemotedHandler.cpp?rev=3609&r1=3608&r2=3609&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/RemotedHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/RemotedHandler.cpp Tue Apr  3 22:37:50 2012
@@ -45,6 +45,12 @@
 # include <xsec/framework/XSECProvider.hpp>
 #endif
 
+#ifdef HAVE_GSSAPI_NAMINGEXTS
+# ifdef SHIBSP_HAVE_GSSMIT
+#  include <gssapi/gssapi_ext.h>
+# endif
+#endif
+
 using namespace shibsp;
 using namespace opensaml;
 using namespace xmltooling;
@@ -64,12 +70,13 @@
         mutable scoped_ptr<CGIParser> m_parser;
         mutable vector<XSECCryptoX509*> m_certs;
 #ifdef SHIBSP_HAVE_GSSAPI
-        mutable gss_ctx_id_t m_gss;
+        mutable gss_ctx_id_t m_gssctx;
+        mutable gss_name_t m_gssname;
 #endif
     public:
         RemotedRequest(DDF& input) : m_input(input), m_parser(nullptr)
 #ifdef SHIBSP_HAVE_GSSAPI
-            , m_gss(GSS_C_NO_CONTEXT)
+            , m_gssctx(GSS_C_NO_CONTEXT), m_gssname(GSS_C_NO_NAME)
 #endif

[... 154 lines stripped ...]


More information about the commits mailing list