[cpp-xmltooling] branch master updated: Removal of more deprecated methods.

Scott Cantor cantor.2 at osu.edu
Fri Apr 27 12:04:26 EDT 2018


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

scantor pushed a commit to branch master
in repository cpp-xmltooling.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-xmltooling.git;a=commit;h=f223ec5149bbf9ce398d5fff802490c21eddf820

The following commit(s) were added to refs/heads/master by this push:
       new  f223ec5   Removal of more deprecated methods.
f223ec5 is described below

commit f223ec5149bbf9ce398d5fff802490c21eddf820
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Fri Apr 27 12:04:19 2018 -0400

    Removal of more deprecated methods.
---
 xmltooling/XMLToolingConfig.cpp                    |  4 --
 xmltooling/XMLToolingConfig.h                      |  8 ----
 xmltooling/base.h                                  |  2 +-
 xmltooling/security/AbstractPKIXTrustEngine.h      |  3 --
 xmltooling/security/SecurityHelper.h               | 39 ++-----------------
 .../security/impl/AbstractPKIXTrustEngine.cpp      | 20 ++++------
 xmltooling/security/impl/SecurityHelper.cpp        | 15 --------
 xmltooling/util/ReloadableXMLFile.cpp              | 17 +++-----
 xmltooling/util/ReloadableXMLFile.h                | 45 ++++++----------------
 xmltooling/util/XMLHelper.cpp                      |  7 +---
 xmltooling/util/XMLHelper.h                        | 10 -----
 xmltoolingtest/SecurityHelperTest.h                |  2 +-
 xmltoolingtest/xmltoolingtest.h                    |  5 ++-
 13 files changed, 36 insertions(+), 141 deletions(-)

diff --git a/xmltooling/XMLToolingConfig.cpp b/xmltooling/XMLToolingConfig.cpp
index d6d0d20..1b69e07 100644
--- a/xmltooling/XMLToolingConfig.cpp
+++ b/xmltooling/XMLToolingConfig.cpp
@@ -416,10 +416,6 @@ bool XMLToolingInternalConfig::init()
         m_pathResolver.reset(new PathResolver());
         m_urlEncoder.reset(new URLEncoder());
 
-        // Load catalogs from deprecated path setting.
-        if (!catalog_path.empty())
-            m_validatingPool->loadCatalogs(catalog_path.c_str());
-
         // default registrations
         XMLObjectBuilder::registerDefaultBuilder(new UnknownElementBuilder());
 
diff --git a/xmltooling/XMLToolingConfig.h b/xmltooling/XMLToolingConfig.h
index b5a2f46..5b8c292 100644
--- a/xmltooling/XMLToolingConfig.h
+++ b/xmltooling/XMLToolingConfig.h
@@ -272,14 +272,6 @@ namespace xmltooling {
          */
         void setURLEncoder(URLEncoder* urlEncoder);
         
-        /**
-         * @deprecated
-         * List of catalog files to load into validating parser pool at initialization time.
-         * <p>Like other path settings, the separator depends on the platform
-         * (semicolon on Windows, colon otherwise). 
-         */
-        std::string catalog_path;
-
         /** A User-Agent header to include in HTTP client requests. */
         std::string user_agent;
 
diff --git a/xmltooling/base.h b/xmltooling/base.h
index 27ae365..cc65fc0 100644
--- a/xmltooling/base.h
+++ b/xmltooling/base.h
@@ -1205,7 +1205,7 @@
  */
 #define PROC_QNAME_ATTRIB(proper,ucase,namespaceURI) \
     if (xmltooling::XMLHelper::isNodeNamed(attribute, namespaceURI, ucase##_ATTRIB_NAME)) { \
-        boost::scoped_ptr<xmltooling::QName> q(xmltooling::XMLHelper::getAttributeValueAsQName(attribute)); \
+        boost::scoped_ptr<xmltooling::QName> q(xmltooling::XMLHelper::getNodeValueAsQName(attribute)); \
         set##proper(q.get()); \
         return; \
     }
diff --git a/xmltooling/security/AbstractPKIXTrustEngine.h b/xmltooling/security/AbstractPKIXTrustEngine.h
index 4c46ad9..80d77e0 100644
--- a/xmltooling/security/AbstractPKIXTrustEngine.h
+++ b/xmltooling/security/AbstractPKIXTrustEngine.h
@@ -72,9 +72,6 @@ namespace xmltooling {
         /** Controls revocation checking, currently limited to CRLs and supports "off", "entityOnly", "fullChain". */
         std::string m_checkRevocation;
 
-        /** Deprecated option, equivalent to checkRevocation="fullChain". */
-        bool m_fullCRLChain;
-
         /** Disable policy mapping when applying PKIX policy checking. */
         bool m_policyMappingInhibit;
 
diff --git a/xmltooling/security/SecurityHelper.h b/xmltooling/security/SecurityHelper.h
index b1e7c58..9fd7829 100644
--- a/xmltooling/security/SecurityHelper.h
+++ b/xmltooling/security/SecurityHelper.h
@@ -156,7 +156,7 @@ namespace xmltooling {
          * @param nowrap    if true, any linefeeds will be stripped from the result
          * @return  the base64 encoded key value
          */
-        static std::string getDEREncoding(const Credential& cred, const char* hash, bool nowrap=true);
+        static std::string getDEREncoding(const Credential& cred, const char* hash=nullptr, bool nowrap=true);
 
         /**
          * Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
@@ -167,7 +167,7 @@ namespace xmltooling {
          * @param nowrap    if true, any linefeeds will be stripped from the result
          * @return  the base64 encoded key value
          */
-        static std::string getDEREncoding(const XSECCryptoKey& key, const char* hash, bool nowrap=true);
+        static std::string getDEREncoding(const XSECCryptoKey& key, const char* hash=nullptr, bool nowrap=true);
 
         /**
          * Returns the base64-encoded DER encoding of a certifiate's public key in SubjectPublicKeyInfo format.
@@ -178,40 +178,7 @@ namespace xmltooling {
          * @param nowrap    if true, any linefeeds will be stripped from the result
          * @return  the base64 encoded key value
          */
-        static std::string getDEREncoding(const XSECCryptoX509& cert, const char* hash, bool nowrap=true);
-
-        /**
-         * @deprecated
-         * Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
-         *
-         * @param cred      the credential containing the key to encode
-         * @param hash      if true, the DER encoded data is hashed with SHA-1 before base64 encoding
-         * @param nowrap    if true, any linefeeds will be stripped from the result
-         * @return  the base64 encoded key value
-         */
-        static std::string getDEREncoding(const Credential& cred, bool hash=false, bool nowrap=true);
-
-        /**
-         * @deprecated
-         * Returns the base64-encoded DER encoding of a public key in SubjectPublicKeyInfo format.
-         *
-         * @param key       the key to encode
-         * @param hash      if true, the DER encoded data is hashed with SHA-1 before base64 encoding
-         * @param nowrap    if true, any linefeeds will be stripped from the result
-         * @return  the base64 encoded key value
-         */
-        static std::string getDEREncoding(const XSECCryptoKey& key, bool hash=false, bool nowrap=true);
-
-        /**
-         * @deprecated
-         * Returns the base64-encoded DER encoding of a certificate's public key in SubjectPublicKeyInfo format.
-         *
-         * @param cert      the certificate's key to encode
-         * @param hash      if true, the DER encoded data is hashed with SHA-1 before base64 encoding
-         * @param nowrap    if true, any linefeeds will be stripped from the result
-         * @return  the base64 encoded key value
-         */
-        static std::string getDEREncoding(const XSECCryptoX509& cert, bool hash=false, bool nowrap=true);
+        static std::string getDEREncoding(const XSECCryptoX509& cert, const char* hash=nullptr, bool nowrap=true);
 
         /**
          * Decodes a DER-encoded public key.
diff --git a/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp b/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp
index e9cee8c..d10c21c 100644
--- a/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp
+++ b/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp
@@ -103,13 +103,13 @@ namespace xmltooling {
     };
 
 
-    static XMLCh fullCRLChain[] =		    UNICODE_LITERAL_12(f,u,l,l,C,R,L,C,h,a,i,n);
-    static XMLCh checkRevocation[] =	    UNICODE_LITERAL_15(c,h,e,c,k,R,e,v,o,c,a,t,i,o,n);
+    static XMLCh fullCRLChain[] =           UNICODE_LITERAL_12(f,u,l,l,C,R,L,C,h,a,i,n);
+    static XMLCh checkRevocation[] =        UNICODE_LITERAL_15(c,h,e,c,k,R,e,v,o,c,a,t,i,o,n);
     static XMLCh policyMappingInhibit[] =   UNICODE_LITERAL_20(p,o,l,i,c,y,M,a,p,p,i,n,g,I,n,h,i,b,i,t);
-    static XMLCh anyPolicyInhibit[] =	    UNICODE_LITERAL_16(a,n,y,P,o,l,i,c,y,I,n,h,i,b,i,t);
+    static XMLCh anyPolicyInhibit[] =       UNICODE_LITERAL_16(a,n,y,P,o,l,i,c,y,I,n,h,i,b,i,t);
     static XMLCh _PathValidator[] =         UNICODE_LITERAL_13(P,a,t,h,V,a,l,i,d,a,t,o,r);
-    static XMLCh PolicyOID[] =			    UNICODE_LITERAL_9(P,o,l,i,c,y,O,I,D);
-    static XMLCh TrustedName[] =		    UNICODE_LITERAL_11(T,r,u,s,t,e,d,N,a,m,e);
+    static XMLCh PolicyOID[] =      	    UNICODE_LITERAL_9(P,o,l,i,c,y,O,I,D);
+    static XMLCh TrustedName[] =            UNICODE_LITERAL_11(T,r,u,s,t,e,d,N,a,m,e);
     static XMLCh type[] =                   UNICODE_LITERAL_4(t,y,p,e);
 };
 
@@ -124,19 +124,15 @@ AbstractPKIXTrustEngine::PKIXValidationInfoIterator::~PKIXValidationInfoIterator
 AbstractPKIXTrustEngine::AbstractPKIXTrustEngine(const xercesc::DOMElement* e)
 	: TrustEngine(e),
 		m_checkRevocation(XMLHelper::getAttrString(e, nullptr, checkRevocation)),
-		m_fullCRLChain(XMLHelper::getAttrBool(e, false, fullCRLChain)),
 		m_policyMappingInhibit(XMLHelper::getAttrBool(e, false, policyMappingInhibit)),
 		m_anyPolicyInhibit(XMLHelper::getAttrBool(e, false, anyPolicyInhibit))
 {
-    if (m_fullCRLChain) {
+    if (m_checkRevocation.empty() && XMLHelper::getAttrBool(e, false, fullCRLChain)) {
         Category::getInstance(XMLTOOLING_LOGCAT ".TrustEngine.PKIX").warn(
-            "fullCRLChain option is deprecated, setting checkRevocation to \"fullChain\""
+            "DEPRECATED: replace fullCRLChain option with checkRevocation set to \"fullChain\""
             );
         m_checkRevocation = "fullChain";
     }
-    else if (m_checkRevocation == "fullChain") {
-        m_fullCRLChain = true; // in case anything's using this
-    }
 
     xercesc::DOMElement* c = XMLHelper::getFirstChildElement(e);
     while (c) {
@@ -166,7 +162,7 @@ AbstractPKIXTrustEngine::AbstractPKIXTrustEngine(const xercesc::DOMElement* e)
                     m_pathValidators.push_back(ptr);
                 }
             }
-            catch (exception& ex) {
+            catch (const exception& ex) {
                 Category::getInstance(XMLTOOLING_LOGCAT ".TrustEngine.PKIX").error(
                     "error building PathValidator: %s", ex.what()
                     );
diff --git a/xmltooling/security/impl/SecurityHelper.cpp b/xmltooling/security/impl/SecurityHelper.cpp
index 03d1c5f..484aaee 100644
--- a/xmltooling/security/impl/SecurityHelper.cpp
+++ b/xmltooling/security/impl/SecurityHelper.cpp
@@ -707,21 +707,6 @@ string SecurityHelper::getDEREncoding(const Credential& cred, const char* hash,
     return "";
 }
 
-string SecurityHelper::getDEREncoding(const XSECCryptoKey& key, bool hash, bool nowrap)
-{
-    return getDEREncoding(key, hash ? "SHA1" : nullptr, nowrap);
-}
-
-string SecurityHelper::getDEREncoding(const XSECCryptoX509& cert, bool hash, bool nowrap)
-{
-    return getDEREncoding(cert, hash ? "SHA1" : nullptr, nowrap);
-}
-
-string SecurityHelper::getDEREncoding(const Credential& cred, bool hash, bool nowrap)
-{
-    return getDEREncoding(cred, hash ? "SHA1" : nullptr, nowrap);
-}
-
 XSECCryptoKey* SecurityHelper::fromDEREncoding(const char* buf, unsigned long buflen, bool base64)
 {
     XMLSize_t x;
diff --git a/xmltooling/util/ReloadableXMLFile.cpp b/xmltooling/util/ReloadableXMLFile.cpp
index 87c61f7..48d0649 100644
--- a/xmltooling/util/ReloadableXMLFile.cpp
+++ b/xmltooling/util/ReloadableXMLFile.cpp
@@ -378,11 +378,6 @@ void ReloadableXMLFile::unlock()
         m_lock->unlock();
 }
 
-pair<bool, DOMElement*> ReloadableXMLFile::load(bool backup)
-{
-    return load(backup, "");
-}
-
 pair<bool,DOMElement*> ReloadableXMLFile::load(bool backup, string backingFile)
 {
 #ifdef _DEBUG
@@ -495,7 +490,7 @@ pair<bool,DOMElement*> ReloadableXMLFile::load()
     // backup of a remote resource (if available), and for backing up remote
     // resources.
     try {
-        pair<bool,DOMElement*> ret = load(false);
+        pair<bool,DOMElement*> ret = load(false, m_backing);
         if (!m_backing.empty()) {
             m_log.debug("backing up remote resource to (%s)", m_backing.c_str());
             try {
@@ -504,13 +499,13 @@ pair<bool,DOMElement*> ReloadableXMLFile::load()
                 backer << *(ret.second->getOwnerDocument());
                 preserveCacheTag();
             }
-            catch (exception& ex) {
+            catch (const exception& ex) {
                 m_log.crit("exception while backing up resource: %s", ex.what());
             }
         }
         return ret;
     }
-    catch (long& responseCode) {
+    catch (long responseCode) {
         // If there's an HTTP error or the document hasn't changed,
         // use the backup iff we have no "valid" resource in place.
         // That prevents reload of the backup copy any time the document
@@ -518,13 +513,13 @@ pair<bool,DOMElement*> ReloadableXMLFile::load()
         if (responseCode == HTTPResponse::XMLTOOLING_HTTP_STATUS_NOTMODIFIED)
             m_log.info("remote resource (%s) unchanged from cached version", m_source.c_str());
         if (!m_loaded && !m_backing.empty())
-            return load(true);
+            return load(true, "");
         throw;
     }
-    catch (exception&) {
+    catch (const exception&) {
         // Same as above, but for general load/parse errors.
         if (!m_loaded && !m_backing.empty())
-            return load(true);
+            return load(true, "");
         throw;
     }
 }
diff --git a/xmltooling/util/ReloadableXMLFile.h b/xmltooling/util/ReloadableXMLFile.h
index f4a234e..0c56b0e 100644
--- a/xmltooling/util/ReloadableXMLFile.h
+++ b/xmltooling/util/ReloadableXMLFile.h
@@ -113,22 +113,6 @@ namespace xmltooling {
         virtual std::pair<bool,xercesc::DOMElement*> background_load();
 
         /**
-         * @deprecated
-         * Basic load/parse of configuration material.
-         * 
-         * <p>The base version performs basic parsing duties and returns the result.
-         * Subclasses should override the new background_load() method and perform
-         * their own locking in conjunction with use of this method.
-         *
-         * <p>Subclasses that continue to override this method will function, but
-         * a write lock will be acquired and held for the entire operation.
-         * 
-         * @return a pair consisting of a flag indicating whether to take ownership of
-         *      the document, and the root element of the tree to load
-         */
-        virtual std::pair<bool,xercesc::DOMElement*> load();
-
-        /**
         * Basic load/parse of configuration material.
         *
         * <p>The base version performs basic parsing duties and returns the result.
@@ -145,10 +129,6 @@ namespace xmltooling {
         * copied to this file.  Thus backup can be done without locking and the
         * job of creating the backup consists of doing a rename (under the lock).</p>
         *
-        * <p> The single parameter version is deprecated and is the same as
-        * calling this version with an empty string at the second parameter
-        * (no backing file).</p>
-        *
         * @param backup      true iff the backup source should be loaded
         * @param backingFile Filename to copy the input to
         * @return a pair consisting of a flag indicating whether to take ownership of
@@ -157,19 +137,6 @@ namespace xmltooling {
         virtual std::pair<bool, xercesc::DOMElement*> load(bool backup, std::string backingFile);
 
         /**
-        * @deprecated
-        * Basic load/parse of configuration material.
-        *
-        * <p>The deprecated version of the two-parameter load method, equivalent to
-        * calling it with an empty second parameter.</p>
-        *
-        * @param backup      true iff the backup source should be loaded
-        * @return a pair consisting of a flag indicating whether to take ownership of
-        *      the document, and the root element of the tree to load
-        */
-        virtual std::pair<bool,xercesc::DOMElement*> load(bool backup);
-
-        /**
          * Accesses a lock interface protecting use of backup file associated with the
          * object.
          *
@@ -180,6 +147,18 @@ namespace xmltooling {
         virtual Lockable* getBackupLock();
 
         /**
+        * Basic load/parse of configuration material.
+        * 
+        * <p>The base version erforms basic parsing duties and returns the result.
+        * Subclasses should override the new background_load() method and perform
+        * their own locking in conjunction with calling this method.
+        * 
+        * @return a pair consisting of a flag indicating whether to take ownership of
+        *      the document, and the root element of the tree to load
+        */
+        std::pair<bool,xercesc::DOMElement*> load();
+
+        /**
          * Preserves the last remote resource caching identifier in a backup file
          * for use on the next restart.
          */
diff --git a/xmltooling/util/XMLHelper.cpp b/xmltooling/util/XMLHelper.cpp
index 0d788c1..957ebd3 100644
--- a/xmltooling/util/XMLHelper.cpp
+++ b/xmltooling/util/XMLHelper.cpp
@@ -180,11 +180,6 @@ xmltooling::QName* XMLHelper::getNodeQName(const DOMNode* domNode)
     return nullptr; 
 }
 
-xmltooling::QName* XMLHelper::getAttributeValueAsQName(const DOMAttr* attribute)
-{
-    return getNodeValueAsQName(attribute);
-}
-
 xmltooling::QName* XMLHelper::getNodeValueAsQName(const DOMNode* domNode)
 {
     if (!domNode)
@@ -376,7 +371,7 @@ bool XMLHelper::getCaseSensitive(const xercesc::DOMElement* e, bool defValue, co
     if (e) {
         const XMLCh* ic = e->getAttributeNS(ns, ignoreCase);
         if (ic && * ic) {
-            Category::getInstance(XMLTOOLING_LOGCAT ".XMLHelper").warn("Deprecated attribute \"ignoreCase\" encountered in configuration. Use \"caseSensitive\".");
+            Category::getInstance(XMLTOOLING_LOGCAT ".XMLHelper").warn("DEPRECATED: attribute \"ignoreCase\" encountered in configuration. Use \"caseSensitive\".");
 
             // caseInsensitive = !"ignoreCase"
             if (*ic == chLatin_t || *ic == chDigit_1)
diff --git a/xmltooling/util/XMLHelper.h b/xmltooling/util/XMLHelper.h
index 835d26f..cc38979 100644
--- a/xmltooling/util/XMLHelper.h
+++ b/xmltooling/util/XMLHelper.h
@@ -157,16 +157,6 @@ namespace xmltooling {
         static QName* getNodeQName(const xercesc::DOMNode* domNode);
 
         /**
-         * @deprecated
-         * Constructs a QName from an attribute's value.
-         * <p>The caller is responsible for freeing the result.
-         *
-         * @param attribute the attribute with a QName value
-         * @return a QName from an attribute's value, or null if the given attribute is null
-         */
-        static QName* getAttributeValueAsQName(const xercesc::DOMAttr* attribute);
-
-        /**
          * Constructs a QName from a node's value.
          * <p>The caller is responsible for freeing the result.
          *
diff --git a/xmltoolingtest/SecurityHelperTest.h b/xmltoolingtest/SecurityHelperTest.h
index 4b24d45..6395c00 100644
--- a/xmltoolingtest/SecurityHelperTest.h
+++ b/xmltoolingtest/SecurityHelperTest.h
@@ -92,7 +92,7 @@ public:
 
         TSM_ASSERT_EQUALS(
             "Certificate and its key produced different DER encodings",
-            SecurityHelper::getDEREncoding(*certs[2]), SecurityHelper::getDEREncoding(*key1.get())
+            SecurityHelper::getDEREncoding(*certs[2], nullptr), SecurityHelper::getDEREncoding(*key1.get(), nullptr)
             );
 
         TSM_ASSERT_EQUALS(
diff --git a/xmltoolingtest/xmltoolingtest.h b/xmltoolingtest/xmltoolingtest.h
index dcc86b0..47a7fdd 100644
--- a/xmltoolingtest/xmltoolingtest.h
+++ b/xmltoolingtest/xmltoolingtest.h
@@ -37,12 +37,15 @@ public:
 
         if (getenv("XMLTOOLINGTEST_DATA"))
             data_path=std::string(getenv("XMLTOOLINGTEST_DATA")) + "/";
-        XMLToolingConfig::getConfig().catalog_path = data_path + "catalog.xml";
 
         if (!XMLToolingConfig::getConfig().init())
             return false;
         if (!XMLToolingConfig::getConfig().init())  // should be a no-op
             return false;
+
+        string catalog_path = data_path + "catalog.xml";
+        if (!XMLToolingConfig::getConfig().getValidatingParser().loadCatalogs(catalog_path.c_str()))
+            return false;
         
         return true;
     }

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


More information about the commits mailing list