[cpp-sp] branch main updated: Remove final xmltooling/xerces refs from build.
Scott Cantor
cantor.2 at osu.edu
Wed Jan 8 21:07:25 UTC 2025
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=793663a67aaa4e9a4aa9172728d924f8cec45cf6
The following commit(s) were added to refs/heads/main by this push:
new 793663a6 Remove final xmltooling/xerces refs from build.
793663a6 is described below
commit 793663a67aaa4e9a4aa9172728d924f8cec45cf6
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Jan 8 16:07:21 2025 -0500
Remove final xmltooling/xerces refs from build.
---
configure.ac | 12 --
shibsp/Makefile.am | 2 -
shibsp/attribute/Attribute.cpp | 2 -
shibsp/attribute/BinaryAttribute.cpp | 129 --------------------
shibsp/attribute/BinaryAttribute.h | 97 ---------------
shibsp/base.h | 12 +-
shibsp/handler/impl/RemotedHandler.cpp | 208 ---------------------------------
shibsp/io/GenericRequest.h | 2 +-
shibsp/remoting/impl/ddf.cpp | 1 -
shibsp/util/CGIParser.cpp | 1 -
shibsp/util/IPRange.cpp | 1 -
shibsp/util/SPConstants.h | 1 -
12 files changed, 9 insertions(+), 459 deletions(-)
diff --git a/configure.ac b/configure.ac
index 165298df..e28832b6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,18 +131,6 @@ else
AC_MSG_RESULT([yes, and it takes $ac_cv_ctime_args arguments])
fi
-AX_PKG_CHECK_MODULES([xerces],,[xerces-c >= 3.2],,,
- [SHIBSP_LITE_REQUIRES],[SHIBSP_LITE_REQUIRES_PRIVATE])
-
-AX_PKG_CHECK_MODULES([xmltooling],,[xmltooling >= 3.1],,,
- [SHIBSP_REQUIRES],[SHIBSP_REQUIRES_PRIVATE])
-PKG_CHECK_VAR([xmltooling_includedir],[xmltooling],[includedir])
-PKG_CHECK_VAR([XMLTOOLINGXMLDIR],[xmltooling],[pkgxmldir])
-DX_INCLUDE="$DX_INCLUDE $xmltooling_includedir"
-
-AX_PKG_CHECK_MODULES([xmltooling_lite],,[xmltooling-lite >= 3.1],,,
- [SHIBSP_LITE_REQUIRES],[SHIBSP_LITE_REQUIRES_PRIVATE])
-
# output the underlying makefiles
WANT_SUBDIRS="doc schemas configs shibsp"
AC_CONFIG_FILES([Makefile doc/Makefile schemas/Makefile \
diff --git a/shibsp/Makefile.am b/shibsp/Makefile.am
index 3c46a039..8b0715be 100644
--- a/shibsp/Makefile.am
+++ b/shibsp/Makefile.am
@@ -35,7 +35,6 @@ libshibspinclude_HEADERS = \
attrinclude_HEADERS = \
attribute/Attribute.h \
- attribute/BinaryAttribute.h \
attribute/ScopedAttribute.h \
attribute/SimpleAttribute.h
@@ -93,7 +92,6 @@ libshibsp_la_SOURCES = \
exceptions.cpp \
version.cpp \
attribute/Attribute.cpp \
- attribute/BinaryAttribute.cpp \
attribute/SimpleAttribute.cpp \
attribute/ScopedAttribute.cpp \
handler/impl/AbstractHandler.cpp \
diff --git a/shibsp/attribute/Attribute.cpp b/shibsp/attribute/Attribute.cpp
index 9ab335d3..b5b07c4b 100644
--- a/shibsp/attribute/Attribute.cpp
+++ b/shibsp/attribute/Attribute.cpp
@@ -35,14 +35,12 @@ using namespace std;
namespace shibsp {
SHIBSP_DLLLOCAL Attribute* SimpleAttributeFactory(DDF& in);
SHIBSP_DLLLOCAL Attribute* ScopedAttributeFactory(DDF& in);
- SHIBSP_DLLLOCAL Attribute* BinaryAttributeFactory(DDF& in);
};
void shibsp::registerAttributeFactories()
{
Attribute::registerFactory("", SimpleAttributeFactory);
Attribute::registerFactory("Simple", SimpleAttributeFactory);
- Attribute::registerFactory("Binary", BinaryAttributeFactory);
Attribute::registerFactory("Scoped", ScopedAttributeFactory);
}
diff --git a/shibsp/attribute/BinaryAttribute.cpp b/shibsp/attribute/BinaryAttribute.cpp
deleted file mode 100644
index 818f6e6e..00000000
--- a/shibsp/attribute/BinaryAttribute.cpp
+++ /dev/null
@@ -1,129 +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.
- */
-
-/**
- * BinaryAttribute.cpp
- *
- * An Attribute whose values are binary data.
- */
-
-#include "internal.h"
-#include "attribute/BinaryAttribute.h"
-
-#include <xercesc/util/Base64.hpp>
-#include <xercesc/util/XMLString.hpp>
-
-using namespace shibsp;
-using namespace xercesc;
-using namespace std;
-
-namespace shibsp {
- SHIBSP_DLLLOCAL Attribute* BinaryAttributeFactory(DDF& in) {
- return new BinaryAttribute(in);
- }
-};
-
-BinaryAttribute::BinaryAttribute(const vector<string>& ids) : Attribute(ids)
-{
-}
-
-BinaryAttribute::BinaryAttribute(DDF& in) : Attribute(in)
-{
- XMLSize_t x;
- DDF val = in.first().first();
- while (val.string()) {
- m_serialized.push_back(val.string());
- XMLByte* decoded=Base64::decode(reinterpret_cast<const XMLByte*>(val.string()), &x);
- if (decoded) {
- m_values.push_back(string(reinterpret_cast<char*>(decoded), x));
- XMLString::release((char**)&decoded);
- }
- val = in.first().next();
- }
-}
-
-BinaryAttribute::~BinaryAttribute()
-{
-}
-
-vector<string>& BinaryAttribute::getValues()
-{
- return m_values;
-}
-
-const vector<string>& BinaryAttribute::getValues() const
-{
- return m_values;
-}
-
-size_t BinaryAttribute::valueCount() const
-{
- return m_values.size();
-}
-
-void BinaryAttribute::clearSerializedValues()
-{
- m_serialized.clear();
-}
-
-const char* BinaryAttribute::getString(size_t index) const
-{
- return m_values[index].c_str();
-}
-
-void BinaryAttribute::removeValue(size_t index)
-{
- Attribute::removeValue(index);
- if (index < m_values.size())
- m_values.erase(m_values.begin() + index);
-}
-
-const vector<string>& BinaryAttribute::getSerializedValues() const
-{
- XMLSize_t len;
- XMLByte *pos, *pos2;
- if (m_serialized.empty()) {
- for (vector<string>::const_iterator i=m_values.begin(); i!=m_values.end(); ++i) {
- XMLByte* enc = Base64::encode(reinterpret_cast<const XMLByte*>(i->data()), i->size(), &len);
- if (enc) {
- for (pos=enc, pos2=enc; *pos2; pos2++)
- if (isgraph(*pos2))
- *pos++=*pos2;
- *pos=0;
- m_serialized.push_back(reinterpret_cast<char*>(enc));
- XMLString::release((char**)&enc);
- }
- }
- }
- return Attribute::getSerializedValues();
-}
-
-DDF BinaryAttribute::marshall() const
-{
- DDF ddf = Attribute::marshall();
- ddf.name("Binary");
- DDF vlist = ddf.first();
- const vector<string>& encoded = getSerializedValues();
- for (vector<string>::const_iterator i = encoded.begin(); i != encoded.end(); ++i) {
- DDF val = DDF(nullptr).string(i->c_str());
- vlist.add(val);
- }
- return ddf;
-}
diff --git a/shibsp/attribute/BinaryAttribute.h b/shibsp/attribute/BinaryAttribute.h
deleted file mode 100644
index 3e3f9ac1..00000000
--- a/shibsp/attribute/BinaryAttribute.h
+++ /dev/null
@@ -1,97 +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/attribute/BinaryAttribute.h
- *
- * An Attribute whose values are binary data.
- */
-
-#ifndef __shibsp_binattr_h__
-#define __shibsp_binattr_h__
-
-#include <shibsp/attribute/Attribute.h>
-
-namespace shibsp {
-
-#if defined (_MSC_VER)
- #pragma warning( push )
- #pragma warning( disable : 4251 )
-#endif
-
- /**
- * An Attribute whose values are binary data.
- *
- * <p>Binary attributes use base64 encoding to serialize their values.
- * The original binary values are accessible in the underlying value
- * collection.
- */
- class SHIBSP_API BinaryAttribute : public Attribute
- {
- public:
- /**
- * Constructor.
- *
- * @param ids array with primary identifier in first position, followed by any aliases
- */
- BinaryAttribute(const std::vector<std::string>& ids);
-
- /**
- * Constructs based on a remoted BinaryAttribute.
- *
- * @param in input object containing marshalled BinaryAttribute
- */
- BinaryAttribute(DDF& in);
-
- virtual ~BinaryAttribute();
-
- /**
- * Returns the set of raw binary values.
- *
- * @return a mutable vector of the values
- */
- std::vector<std::string>& getValues();
-
- /**
- * Returns the set of raw binary values.
- *
- * @return an immutable vector of the values
- */
- const std::vector<std::string>& getValues() const;
-
- // Virtual function overrides.
- size_t valueCount() const;
- void clearSerializedValues();
- const char* getString(size_t index) const;
- void removeValue(size_t index);
- const std::vector<std::string>& getSerializedValues() const;
- DDF marshall() const;
-
- private:
- std::vector<std::string> m_values;
- };
-
-#if defined (_MSC_VER)
- #pragma warning( pop )
-#endif
-
-};
-
-#endif /* __shibsp_scopedattr_h__ */
diff --git a/shibsp/base.h b/shibsp/base.h
index ea03749c..bb8544af 100644
--- a/shibsp/base.h
+++ b/shibsp/base.h
@@ -22,10 +22,6 @@
#ifndef __shibsp_base_h__
#define __shibsp_base_h__
-// TODO: remove
-#define XMLTOOLING_LITE
-#include <xmltooling/base.h>
-
#if defined (_MSC_VER) || defined(__BORLANDC__)
#include <shibsp/config_pub_win32.h>
#else
@@ -67,6 +63,14 @@
#define SHIBSP_EXCEPTIONAPI(api)
#endif
+/**
+ * Blocks copy c'tor and assignment operator for a class.
+ */
+#define MAKE_NONCOPYABLE(type) \
+ private: \
+ type(const type&); \
+ type& operator=(const type&)
+
/** Logging category for Service Provider functions. */
#define SHIBSP_LOGCAT "Shibboleth"
diff --git a/shibsp/handler/impl/RemotedHandler.cpp b/shibsp/handler/impl/RemotedHandler.cpp
index eddfefcb..bd2450f5 100644
--- a/shibsp/handler/impl/RemotedHandler.cpp
+++ b/shibsp/handler/impl/RemotedHandler.cpp
@@ -25,165 +25,11 @@
#include <algorithm>
#include <sstream>
-#include <boost/scoped_ptr.hpp>
-#include <xmltooling/unicode.h>
-#include <xercesc/util/Base64.hpp>
using namespace shibsp;
-using namespace xmltooling;
-using namespace xercesc;
-using namespace boost;
using namespace std;
#ifndef SHIBSP_LITE
-namespace shibsp {
- class SHIBSP_DLLLOCAL RemotedRequest : public HTTPRequest
- {
- const Application* m_app;
- DDF& m_input;
- mutable scoped_ptr<CGIParser> m_parser;
- mutable vector<XSECCryptoX509*> m_certs;
- public:
- RemotedRequest(const Application* app, DDF& input) : m_app(app), m_input(input), m_parser(nullptr)
- {
- }
-
- virtual ~RemotedRequest() {
- for_each(m_certs.begin(), m_certs.end(), xmltooling::cleanup<XSECCryptoX509>());
- }
-
- // GenericRequest
- const char* getScheme() const {
- return m_input["scheme"].string();
- }
- bool isSecure() const {
- return HTTPRequest::isSecure();
- }
- const char* getHostname() const {
- return m_input["hostname"].string();
- }
- int getPort() const {
- return m_input["port"].integer();
- }
- std::string getContentType() const {
- DDF s = m_input["content_type"];
- return s.string() ? s.string() : "";
- }
- long getContentLength() const {
- return m_input["content_length"].integer();
- }
- const char* getRequestBody() const {
- return m_input["body"].string();
- }
-
- const char* getParameter(const char* name) const;
- std::vector<const char*>::size_type getParameters(const char* name, std::vector<const char*>& values) const;
-
- std::string getRemoteUser() const {
- DDF s = m_input["remote_user"];
- return s.string() ? s.string() : "";
- }
- std::string getRemoteAddr() const {
- DDF s = m_input["client_addr"];
- return s.string() ? s.string() : "";
- }
-
- const std::vector<XSECCryptoX509*>& getClientCertificates() const;
-
- // HTTPRequest
- const char* getMethod() const {
- return m_input["method"].string();
- }
- const char* getRequestURI() const {
- return m_input["uri"].string();
- }
- const char* getRequestURL() const {
- return m_input["url"].string();
- }
- const char* getQueryString() const {
- return m_input["query"].string();
- }
- std::string getHeader(const char* name) const {
- DDF s = m_input["headers"][name];
- return s.string() ? s.string() : "";
- }
- const char* getCookie(const char* name) const {
- pair<bool,bool> sameSiteFallback = pair<bool,bool>(false, false);
- const PropertySet* props = m_app ? m_app->getPropertySet("Sessions") : nullptr;
- if (props) {
- sameSiteFallback = props->getBool("sameSiteFallback");
- }
- return HTTPRequest::getCookie(name, sameSiteFallback.first && sameSiteFallback.second);
- }
- };
-
- class SHIBSP_DLLLOCAL RemotedResponse : public virtual HTTPResponse
- {
- const Application* m_app;
- DDF& m_output;
- public:
- RemotedResponse(const Application* app, DDF& output) : m_app(app), m_output(output) {}
- virtual ~RemotedResponse() {}
-
- // GenericResponse
- long sendResponse(std::istream& inputStream, long status);
-
- // HTTPResponse
- void setCookie(const char* name, const char* value, time_t expires = 0, samesite_t sameSite = SAMESITE_ABSENT);
- void setResponseHeader(const char* name, const char* value, bool replace=false);
- long sendRedirect(const char* url);
- };
-}
-
-const char* RemotedRequest::getParameter(const char* name) const
-{
- if (!m_parser)
- m_parser.reset(new CGIParser(*this));
-
- pair<CGIParser::walker,CGIParser::walker> bounds = m_parser->getParameters(name);
- return (bounds.first==bounds.second) ? nullptr : bounds.first->second;
-}
-
-std::vector<const char*>::size_type RemotedRequest::getParameters(const char* name, std::vector<const char*>& values) const
-{
- if (!m_parser)
- m_parser.reset(new CGIParser(*this));
-
- pair<CGIParser::walker,CGIParser::walker> bounds = m_parser->getParameters(name);
- while (bounds.first != bounds.second) {
- values.push_back(bounds.first->second);
- ++bounds.first;
- }
- return values.size();
-}
-
-const std::vector<XSECCryptoX509*>& RemotedRequest::getClientCertificates() const
-{
- if (m_certs.empty()) {
- DDF certs = m_input["certificates"];
- DDF cert = certs.first();
- while (cert.string()) {
- try {
- auto_ptr<XSECCryptoX509> x509(XSECPlatformUtils::g_cryptoProvider->X509());
- if (strstr(cert.string(), "BEGIN"))
- x509->loadX509PEM(cert.string(), cert.strlen());
- else
- x509->loadX509Base64Bin(cert.string(), cert.strlen());
- m_certs.push_back(x509.get());
- x509.release();
- }
- catch(XSECException& e) {
- auto_ptr_char temp(e.getMsg());
- Category::getInstance(SHIBSP_LOGCAT ".SPRequest").error("XML-Security exception loading client certificate: %s", temp.get());
- }
- catch(XSECCryptoException& e) {
- Category::getInstance(SHIBSP_LOGCAT ".SPRequest").error("XML-Security exception loading client certificate: %s", e.getMsg());
- }
- cert = certs.next();
- }
- }
- return m_certs;
-}
void RemotedResponse::setCookie(const char* name, const char* value, time_t expires, samesite_t sameSite)
{
@@ -223,62 +69,8 @@ void RemotedResponse::setCookie(const char* name, const char* value, time_t expi
}
}
-long RemotedResponse::sendResponse(std::istream& in, long status)
-{
- string msg;
- char buf[1024];
- while (in) {
- in.read(buf, 1024);
- msg.append(buf, in.gcount());
- }
- if (!m_output.isstruct())
- m_output.structure();
- m_output.addmember("response.data").unsafe_string(msg.c_str());
- m_output.addmember("response.status").integer(status);
- return status;
-}
-
-void RemotedResponse::setResponseHeader(const char* name, const char* value, bool replace)
-{
- HTTPResponse::setResponseHeader(name, value, replace);
-
- if (!m_output.isstruct())
- m_output.structure();
- DDF hdrs = m_output["headers"];
- if (hdrs.isnull())
- hdrs = m_output.addmember("headers").list();
- if (replace || !value) {
- DDF hdr = hdrs.first();
- while (!hdr.isnull()) {
- if (hdr.name() && !strcmp(hdr.name(), name))
- hdr.destroy();
- hdr = hdrs.next();
- }
- }
-
- if (value && *value) {
- DDF h = DDF(name).unsafe_string(value);
- hdrs.add(h);
- }
-}
-
-long RemotedResponse::sendRedirect(const char* url)
-{
- if (!m_output.isstruct())
- m_output.structure();
- m_output.addmember("redirect").unsafe_string(url);
- return HTTPResponse::XMLTOOLING_HTTP_STATUS_MOVED;
-}
-
#endif
-void RemotedHandler::setAddress(const char* address)
-{
- if (!m_address.empty())
- throw ConfigurationException("Cannot register a remoting address twice for the same Handler.");
- m_address = address;
-}
-
set<string> RemotedHandler::m_remotedHeaders;
RemotedHandler::RemotedHandler()
diff --git a/shibsp/io/GenericRequest.h b/shibsp/io/GenericRequest.h
index 4261daa9..94e5067a 100644
--- a/shibsp/io/GenericRequest.h
+++ b/shibsp/io/GenericRequest.h
@@ -21,7 +21,7 @@
#ifndef __shibsp_genreq_h__
#define __shibsp_genreq_h__
-#include <xmltooling/unicode.h>
+#include <shibsp/base.h>
#include <string>
#include <vector>
diff --git a/shibsp/remoting/impl/ddf.cpp b/shibsp/remoting/impl/ddf.cpp
index 3bb8169d..6461b8f4 100644
--- a/shibsp/remoting/impl/ddf.cpp
+++ b/shibsp/remoting/impl/ddf.cpp
@@ -28,7 +28,6 @@
#include <boost/lexical_cast.hpp>
using namespace shibsp;
-using namespace xmltooling;
using namespace std;
// defensive string functions
diff --git a/shibsp/util/CGIParser.cpp b/shibsp/util/CGIParser.cpp
index abadcd4a..a8f1ce4a 100644
--- a/shibsp/util/CGIParser.cpp
+++ b/shibsp/util/CGIParser.cpp
@@ -26,7 +26,6 @@
#include "util/URLEncoder.h"
using namespace shibsp;
-using namespace xmltooling;
using namespace std;
namespace {
diff --git a/shibsp/util/IPRange.cpp b/shibsp/util/IPRange.cpp
index 354010d5..da954870 100644
--- a/shibsp/util/IPRange.cpp
+++ b/shibsp/util/IPRange.cpp
@@ -32,7 +32,6 @@
#endif
using namespace shibsp;
-using namespace xmltooling;
using namespace std;
namespace {
diff --git a/shibsp/util/SPConstants.h b/shibsp/util/SPConstants.h
index 048ca6d9..fb8c4675 100644
--- a/shibsp/util/SPConstants.h
+++ b/shibsp/util/SPConstants.h
@@ -28,7 +28,6 @@
#define __shibsp_constants_h__
#include <shibsp/base.h>
-#include <xercesc/util/XercesDefs.hpp>
/**
* Shibboleth SP XML constants.
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list