[cpp-sp] branch main updated: Excise GSSRequest code.

Scott Cantor cantor.2 at osu.edu
Tue Oct 29 18:19:04 UTC 2024


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

The following commit(s) were added to refs/heads/main by this push:
     new c119aff7 Excise GSSRequest code.
c119aff7 is described below

commit c119aff7b89bf0875e9bb880e80d19c6723e4184
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Oct 29 14:19:00 2024 -0400

    Excise GSSRequest code.
---
 apache/mod_shib_24.cpp                 |   1 -
 shibsp/AbstractSPRequest.cpp           |  15 ----
 shibsp/GSSRequest.h                    |  72 ----------------
 shibsp/Makefile.am                     |   1 -
 shibsp/handler/impl/RemotedHandler.cpp | 147 +--------------------------------
 5 files changed, 1 insertion(+), 235 deletions(-)

diff --git a/apache/mod_shib_24.cpp b/apache/mod_shib_24.cpp
index 01a18e31..fe99d237 100644
--- a/apache/mod_shib_24.cpp
+++ b/apache/mod_shib_24.cpp
@@ -39,7 +39,6 @@
 #include <shibsp/exceptions.h>
 #include <shibsp/AbstractSPRequest.h>
 #include <shibsp/AccessControl.h>
-#include <shibsp/GSSRequest.h>
 #include <shibsp/RequestMapper.h>
 #include <shibsp/SPConfig.h>
 #include <shibsp/ServiceProvider.h>
diff --git a/shibsp/AbstractSPRequest.cpp b/shibsp/AbstractSPRequest.cpp
index 36db1d4b..7ed4b90a 100644
--- a/shibsp/AbstractSPRequest.cpp
+++ b/shibsp/AbstractSPRequest.cpp
@@ -28,7 +28,6 @@
 #include "exceptions.h"
 #include "AbstractSPRequest.h"
 #include "Application.h"
-#include "GSSRequest.h"
 #include "ServiceProvider.h"
 #include "SessionCache.h"
 #include "util/CGIParser.h"
@@ -48,20 +47,6 @@ SPRequest::~SPRequest()
 {
 }
 
-#ifdef SHIBSP_HAVE_GSSAPI
-GSSRequest::GSSRequest()
-{
-}
-
-GSSRequest::~GSSRequest()
-{
-}
-
-gss_name_t GSSRequest::getGSSName() const
-{
-    return GSS_C_NO_NAME;
-}
-#endif
 
 AbstractSPRequest::AbstractSPRequest(const char* category)
     : m_sp(SPConfig::getConfig().getServiceProvider()),
diff --git a/shibsp/GSSRequest.h b/shibsp/GSSRequest.h
deleted file mode 100644
index a703e581..00000000
--- a/shibsp/GSSRequest.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * Licensed to the University Corporation for Advanced Internet
- * Development, Inc. (UCAID) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for
- * additional information regarding copyright ownership.
- *
- * UCAID licenses this file to you under the Apache License,
- * Version 2.0 (the "License"); you may not use this file except
- * in compliance with the License. You may obtain a copy of the
- * License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific
- * language governing permissions and limitations under the License.
- */
-
-/**
- * @file shibsp/GSSRequest.h
- *
- * Interface to a GSS-authenticated request.
- */
-
-#if !defined(__shibsp_gssreq_h__) && defined(SHIBSP_HAVE_GSSAPI)
-#define __shibsp_gssreq_h__
-
-#include <shibsp/base.h>
-#include <xmltooling/io/GenericRequest.h>
-
-#ifdef SHIBSP_HAVE_GSSGNU
-# include <gss.h>
-#elif defined SHIBSP_HAVE_GSSMIT
-# include <gssapi/gssapi.h>
-# include <gssapi/gssapi_generic.h>
-#else
-# include <gssapi.h>
-#endif
-
-namespace shibsp {
-
-    /**
-     * Interface to a GSS-authenticated request.
-     */
-    class SHIBSP_API GSSRequest : public virtual xmltooling::GenericRequest
-    {
-    protected:
-        GSSRequest();
-    public:
-        virtual ~GSSRequest();
-
-        /**
-         * Returns the GSS-API context established for this request, or
-         * GSS_C_NO_CONTEXT if none is available.
-         *
-         * @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;
-    };
-};
-
-#endif /* __shibsp_gssreq_h__ */
diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 09406d99..73dfcce4 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -34,7 +34,6 @@ libshibspinclude_HEADERS = \
 	Application.h \
 	base.h \
 	exceptions.h \
-	GSSRequest.h \
 	RequestMapper.h \
 	ServiceProvider.h \
 	SessionCache.h \
diff --git a/shibsp/handler/impl/RemotedHandler.cpp b/shibsp/handler/impl/RemotedHandler.cpp
index 2fd941e5..e7ac7714 100644
--- a/shibsp/handler/impl/RemotedHandler.cpp
+++ b/shibsp/handler/impl/RemotedHandler.cpp
@@ -27,7 +27,6 @@
 #include "internal.h"
 #include "exceptions.h"
 #include "Application.h"
-#include "GSSRequest.h"
 #include "ServiceProvider.h"
 #include "SPRequest.h"
 #include "handler/RemotedHandler.h"
@@ -45,12 +44,6 @@
 # include <xsec/framework/XSECProvider.hpp>
 #endif
 
-#if HAVE_DECL_GSS_GET_NAME_ATTRIBUTE
-# ifdef SHIBSP_HAVE_GSSMIT
-#  include <gssapi/gssapi_ext.h>
-# endif
-#endif
-
 using namespace shibsp;
 using namespace opensaml;
 using namespace xmltooling;
@@ -60,37 +53,19 @@ using namespace std;
 
 #ifndef SHIBSP_LITE
 namespace shibsp {
-    class SHIBSP_DLLLOCAL RemotedRequest : 
-#ifdef SHIBSP_HAVE_GSSAPI
-        public GSSRequest,
-#endif
-        public HTTPRequest
+    class SHIBSP_DLLLOCAL RemotedRequest : public HTTPRequest
     {
         const Application* m_app;
         DDF& m_input;
         mutable scoped_ptr<CGIParser> m_parser;
         mutable vector<XSECCryptoX509*> m_certs;
-#ifdef SHIBSP_HAVE_GSSAPI
-        mutable gss_ctx_id_t m_gssctx;
-        mutable gss_name_t m_gssname;
-#endif
     public:
         RemotedRequest(const Application* app, DDF& input) : m_app(app), m_input(input), m_parser(nullptr)
-#ifdef SHIBSP_HAVE_GSSAPI
-            , m_gssctx(GSS_C_NO_CONTEXT), m_gssname(GSS_C_NO_NAME)
-#endif
         {
         }
 
         virtual ~RemotedRequest() {
             for_each(m_certs.begin(), m_certs.end(), xmltooling::cleanup<XSECCryptoX509>());
-#ifdef SHIBSP_HAVE_GSSAPI
-            OM_uint32 minor;
-            if (m_gssctx != GSS_C_NO_CONTEXT)
-                gss_delete_sec_context(&minor, &m_gssctx, GSS_C_NO_BUFFER);
-            if (m_gssname != GSS_C_NO_NAME)
-                gss_release_name(&minor, &m_gssname);
-#endif
         }
 
         // GenericRequest
@@ -131,12 +106,6 @@ namespace shibsp {
 
         const std::vector<XSECCryptoX509*>& getClientCertificates() const;
         
-#ifdef SHIBSP_HAVE_GSSAPI
-        // GSSRequest
-        gss_ctx_id_t getGSSContext() const;
-        gss_name_t getGSSName() const;
-#endif
-
         // HTTPRequest
         const char* getMethod() const {
             return m_input["method"].string();
@@ -232,64 +201,6 @@ const std::vector<XSECCryptoX509*>& RemotedRequest::getClientCertificates() cons
     return m_certs;
 }
 
-#ifdef SHIBSP_HAVE_GSSAPI
-gss_ctx_id_t RemotedRequest::getGSSContext() const
-{
-    if (m_gssctx == GSS_C_NO_CONTEXT) {
-        const char* encoded = m_input["gss_context"].string();
-        if (encoded) {
-            XMLSize_t x;
-            XMLByte* decoded = Base64::decode(reinterpret_cast<const XMLByte*>(encoded), &x);
-            if (decoded) {
-                gss_buffer_desc importbuf;
-                importbuf.length = x;
-                importbuf.value = decoded;
-                OM_uint32 minor;
-                OM_uint32 major = gss_import_sec_context(&minor, &importbuf, &m_gssctx);
-                if (major != GSS_S_COMPLETE)
-                    m_gssctx = GSS_C_NO_CONTEXT;
-                XMLString::release((char**)&decoded);
-            }
-        }
-    }
-    return m_gssctx;
-}
-
-gss_name_t RemotedRequest::getGSSName() const
-{
-    if (m_gssname == GSS_C_NO_NAME) {
-        const char* encoded = m_input["gss_name"].string();
-        if (encoded) {
-            XMLSize_t x;
-            XMLByte* decoded = Base64::decode(reinterpret_cast<const XMLByte*>(encoded), &x);
-            gss_buffer_desc importbuf;
-            importbuf.length = x;
-            importbuf.value = decoded;
-            OM_uint32 major,minor;
-#if HAVE_DECL_GSS_C_NT_EXPORT_NAME_COMPOSITE
-            major = gss_import_name(&minor, &importbuf, GSS_C_NT_EXPORT_NAME_COMPOSITE, &m_gssname);
-#else
-            major = gss_import_name(&minor, &importbuf, GSS_C_NT_EXPORT_NAME, &m_gssname);
-#endif
-            if (major != GSS_S_COMPLETE)
-                m_gssname = GSS_C_NO_NAME;
-            XMLString::release((char**)&decoded);
-        }
-
-        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
-
 void RemotedResponse::setCookie(const char* name, const char* value, time_t expires, samesite_t sameSite)
 {
     static const char* defProps="; path=/; HttpOnly";
@@ -476,62 +387,6 @@ DDF RemotedHandler::wrap(const SPRequest& request, const vector<string>* headers
 #endif
     }
 
-#ifdef SHIBSP_HAVE_GSSAPI
-    const GSSRequest* gss = dynamic_cast<const GSSRequest*>(&request);
-    if (gss) {
-        gss_ctx_id_t ctx = gss->getGSSContext();
-        if (ctx != GSS_C_NO_CONTEXT) {
-            OM_uint32 minor;
-            gss_buffer_desc contextbuf = GSS_C_EMPTY_BUFFER;
-            OM_uint32 major = gss_export_sec_context(&minor, &ctx, &contextbuf);
-            if (major == GSS_S_COMPLETE) {
-                XMLSize_t len = 0;
-                XMLByte* out = Base64::encode(reinterpret_cast<const XMLByte*>(contextbuf.value), contextbuf.length, &len);
-                gss_release_buffer(&minor, &contextbuf);
-                if (out) {
-                    string ctx;
-                    ctx.append(reinterpret_cast<char*>(out), len);
-                    XMLString::release((char**)&out);
-                    in.addmember("gss_context").string(ctx.c_str());
-                }
-                else {
-                    request.log(SPRequest::SPError, "error while base64-encoding GSS context");
-                }
-            }
-            else {
-                request.log(SPRequest::SPError, "error while exporting GSS context");
-            }
-        }
-#if HAVE_DECL_GSS_GET_NAME_ATTRIBUTE
-        else {
-            gss_name_t name = gss->getGSSName();
-            if (name != GSS_C_NO_NAME) {
-                OM_uint32 minor;
-                gss_buffer_desc namebuf = GSS_C_EMPTY_BUFFER;
-                OM_uint32 major = gss_export_name_composite(&minor, name, &namebuf);
-                if (major == GSS_S_COMPLETE) {
-                    XMLSize_t len = 0;
-                    XMLByte* out = Base64::encode(reinterpret_cast<const XMLByte*>(namebuf.value), namebuf.length, &len);
-                    gss_release_buffer(&minor, &namebuf);
-                    if (out) {
-                        string nm;
-                        nm.append(reinterpret_cast<char*>(out), len);
-                        XMLString::release((char**)&out);
-                        in.addmember("gss_name").string(nm.c_str());
-                    }
-                    else {
-                        request.log(SPRequest::SPError, "error while base64-encoding GSS name");
-                    }
-                }
-                else {
-                    request.log(SPRequest::SPError, "error while exporting GSS name");
-                }
-            }
-        }
-#endif
-    }
-#endif
-
     return in;
 }
 

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


More information about the commits mailing list