[cpp-sp] branch master updated: SSPCPP-793 - auto_ptr cleanup

Scott Cantor cantor.2 at osu.edu
Tue Apr 10 09:59:38 EDT 2018


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

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

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

The following commit(s) were added to refs/heads/master by this push:
       new  2d8027b   SSPCPP-793 - auto_ptr cleanup
2d8027b is described below

commit 2d8027b08b14ad090c491b0ec1898d5d10db8ed3
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Apr 10 09:57:57 2018 -0400

    SSPCPP-793 - auto_ptr cleanup
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-793
---
 shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp |  6 +++---
 shibsp/binding/impl/ArtifactResolver.cpp                 |  4 ++--
 shibsp/handler/impl/ExternalAuthHandler.cpp              |  2 +-
 shibsp/impl/StorageServiceSessionCache.cpp               |  4 ++--
 shibsp/metadata/DynamicMetadataProvider.cpp              |  2 +-
 unittests/DynamicMetadataProviderTest.h                  | 16 +++++++++-------
 6 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp
index bd4949b..83de1d1 100644
--- a/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp
+++ b/shibsp/attribute/resolver/impl/XMLAttributeExtractor.cpp
@@ -310,9 +310,9 @@ XMLExtractorImpl::XMLExtractorImpl(const DOMElement* e, Category& log)
         try {
             DOMElement* dchild = XMLHelper::getFirstChildElement(child, shibspconstants::SHIB2ATTRIBUTEMAP_NS, _AttributeDecoder);
             if (dchild) {
-                auto_ptr<xmltooling::QName> q(XMLHelper::getXSIType(dchild));
-                if (q.get())
-                    decoder.reset(SPConfig::getConfig().AttributeDecoderManager.newPlugin(*q.get(), dchild));
+                scoped_ptr<xmltooling::QName> q(XMLHelper::getXSIType(dchild));
+                if (q)
+                    decoder.reset(SPConfig::getConfig().AttributeDecoderManager.newPlugin(*q, dchild));
             }
             if (!decoder)
                 decoder.reset(SPConfig::getConfig().AttributeDecoderManager.newPlugin(StringAttributeDecoderType, nullptr));
diff --git a/shibsp/binding/impl/ArtifactResolver.cpp b/shibsp/binding/impl/ArtifactResolver.cpp
index 41bc232..9dd2139 100644
--- a/shibsp/binding/impl/ArtifactResolver.cpp
+++ b/shibsp/binding/impl/ArtifactResolver.cpp
@@ -124,7 +124,7 @@ saml1p::Response* ArtifactResolver::resolve(
         throw BindingException("Unable to resolve artifact(s) into a SAML response.");
     const xmltooling::QName* code = (response->getStatus() && response->getStatus()->getStatusCode()) ? response->getStatus()->getStatusCode()->getValue() : nullptr;
     if (!code || *code != saml1p::StatusCode::SUCCESS) {
-        auto_ptr<saml1p::Response> wrapper(response);
+        scoped_ptr<saml1p::Response> wrapper(response);
         BindingException ex("Identity provider returned a SAML error during artifact resolution.");
         annotateException(&ex, &idpDescriptor, response->getStatus());  // rethrow
     }
@@ -248,7 +248,7 @@ ArtifactResponse* ArtifactResolver::resolve(
         throw BindingException("Unable to resolve artifact(s) into a SAML response.");
     else if (!response->getStatus() || !response->getStatus()->getStatusCode() ||
            !XMLString::equals(response->getStatus()->getStatusCode()->getValue(), saml2p::StatusCode::SUCCESS)) {
-        auto_ptr<ArtifactResponse> wrapper(response);
+        scoped_ptr<ArtifactResponse> wrapper(response);
         BindingException ex("Identity provider returned a SAML error during artifact resolution.");
         annotateException(&ex, &ssoDescriptor, response->getStatus());  // rethrow
     }
diff --git a/shibsp/handler/impl/ExternalAuthHandler.cpp b/shibsp/handler/impl/ExternalAuthHandler.cpp
index 39a5f3e..8c92837 100644
--- a/shibsp/handler/impl/ExternalAuthHandler.cpp
+++ b/shibsp/handler/impl/ExternalAuthHandler.cpp
@@ -273,7 +273,7 @@ pair<bool,long> ExternalAuth::processMessage(
         Wrapper4InputSource dsrc(&src, false);
         DOMDocument* doc = XMLToolingConfig::getConfig().getParser().parse(dsrc);
         XercesJanitor<DOMDocument> janitor(doc);
-        auto_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
+        scoped_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
         janitor.release();
 
         saml2::Assertion* token = dynamic_cast<saml2::Assertion*>(xmlObject.get());
diff --git a/shibsp/impl/StorageServiceSessionCache.cpp b/shibsp/impl/StorageServiceSessionCache.cpp
index 1205e0a..84af747 100644
--- a/shibsp/impl/StorageServiceSessionCache.cpp
+++ b/shibsp/impl/StorageServiceSessionCache.cpp
@@ -1151,7 +1151,7 @@ bool SSCache::recover(const Application& app, const char* key, const char* data)
             return false;
         }
 
-        auto_ptr<saml2::NameID> nameidObject;
+        scoped_ptr<saml2::NameID> nameidObject;
         const char* nameid = obj["nameid"].string();
         if (nameid) {
             // Parse and bind the document into an XMLObject.
@@ -1171,7 +1171,7 @@ bool SSCache::recover(const Application& app, const char* key, const char* data)
         }
 
         // Store the reverse mapping for logout.
-        auto_ptr_char name(nameidObject.get() ? nameidObject->getName() : nullptr);
+        auto_ptr_char name(nameidObject ? nameidObject->getName() : nullptr);
         if (name.get() && *name.get() && m_reverseIndex
             && (m_excludedNames.size() == 0 || m_excludedNames.count(nameidObject->getName()) == 0)) {
             try {
diff --git a/shibsp/metadata/DynamicMetadataProvider.cpp b/shibsp/metadata/DynamicMetadataProvider.cpp
index 412887e..1717341 100644
--- a/shibsp/metadata/DynamicMetadataProvider.cpp
+++ b/shibsp/metadata/DynamicMetadataProvider.cpp
@@ -89,7 +89,7 @@ namespace shibsp {
         string m_subst, m_match, m_regex, m_hashed, m_cacheDir;
         boost::scoped_ptr<X509TrustEngine> m_trust;
         boost::scoped_ptr<CredentialResolver> m_dummyCR;
-        auto_ptr<Thread> m_init_thread;
+        boost::scoped_ptr<Thread> m_init_thread;
         Category & m_log;
 
         static void* init_fn(void*);
diff --git a/unittests/DynamicMetadataProviderTest.h b/unittests/DynamicMetadataProviderTest.h
index 7c411fa..def7610 100644
--- a/unittests/DynamicMetadataProviderTest.h
+++ b/unittests/DynamicMetadataProviderTest.h
@@ -49,13 +49,15 @@ using namespace opensaml::saml2md;
 using namespace opensaml::saml2p;
 using namespace shibsp;
 
+using boost::scoped_ptr;
+
 extern string data_path;
 
 class DynamicMetadataTest : public CxxTest::TestSuite {
  private:
     const string m_entityId;
     const string m_entityIdFail;
-    auto_ptr<SAML2ArtifactType0004> m_artifact;
+    scoped_ptr<SAML2ArtifactType0004> m_artifact;
 public:
     DynamicMetadataTest() : CxxTest::TestSuite(), m_entityId("https://idp.shibboleth.net/idp/shibboleth"),
         m_entityIdFail("https://idp.shibboleth.net/idp/shibboleth/Fail"), m_artifact(nullptr)
@@ -77,7 +79,7 @@ private:
         const XMLToolingConfig& xcf = XMLToolingConfig::getConfig();
         ParserPool& pool = xcf.getParser();
         XercesJanitor<DOMDocument> janitor(pool.parse(in));
-        auto_ptr<MetadataProvider> metadataProvider(
+        scoped_ptr<MetadataProvider> metadataProvider(
             opensaml::SAMLConfig::getConfig().MetadataProviderManager.newPlugin(type, janitor.get()->getDocumentElement())
         );
 
@@ -142,7 +144,7 @@ private:
         XMLToolingConfig& xcf = XMLToolingConfig::getConfig();
         ParserPool& pool = xcf.getParser();
         XercesJanitor<DOMDocument> janitor(pool.parse(in));
-        auto_ptr<MetadataProvider> metadataProvider(
+        scoped_ptr<MetadataProvider> metadataProvider(
             opensaml::SAMLConfig::getConfig().MetadataProviderManager.newPlugin(DYNAMIC_METADATA_PROVIDER, janitor.get()->getDocumentElement())
         );
 
@@ -159,11 +161,11 @@ private:
                 TS_ASSERT(nullptr == thePair.first);
             }
 
-            auto_ptr<SAML2ArtifactType0004> testArtifact(new SAML2ArtifactType0004(SecurityHelper::doHash("SHA1", testEntity.data(), testEntity.length(), false), 666));
+            scoped_ptr<SAML2ArtifactType0004> testArtifact(new SAML2ArtifactType0004(SecurityHelper::doHash("SHA1", testEntity.data(), testEntity.length(), false), 666));
             MetadataProviderCriteria artifactCrit(testApp, testArtifact.get());
             pair<const EntityDescriptor*, const RoleDescriptor*>  artefactPair = metadataProvider->getEntityDescriptor(artifactCrit);
             TS_ASSERT(nullptr != artefactPair.first);
-        } catch (XMLToolingException& ex) {
+        } catch (const XMLToolingException& ex) {
             TS_TRACE(ex.what());
             throw;
         }
@@ -187,7 +189,7 @@ public:
         XMLToolingConfig& xcf = XMLToolingConfig::getConfig();
         ParserPool& pool = xcf.getParser();
         XercesJanitor<DOMDocument> janitor(pool.parse(in));
-        auto_ptr<MetadataProvider> metadataProvider(
+        scoped_ptr<MetadataProvider> metadataProvider(
             opensaml::SAMLConfig::getConfig().MetadataProviderManager.newPlugin(DYNAMIC_METADATA_PROVIDER, janitor.get()->getDocumentElement())
         );
 
@@ -198,7 +200,7 @@ public:
             MetadataProviderCriteria crit(testApp, testEntity.c_str());
             pair<const EntityDescriptor*, const RoleDescriptor*>  thePair = metadataProvider->getEntityDescriptor(crit);
             TS_ASSERT(nullptr == thePair.first);
-        } catch (XMLToolingException& ex) {
+        } catch (const XMLToolingException& ex) {
             TS_TRACE(ex.what());
             throw;
         }

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


More information about the commits mailing list