Switch to shibtarget cleanup functors
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 30 Jan 2006 03:05:35 +0000 (03:05 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Mon, 30 Jan 2006 03:05:35 +0000 (03:05 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1972 cb58f699-b61c-0410-a6fe-9272a202ed29

xmlproviders/CredResolvers.cpp
xmlproviders/XMLAAP.cpp
xmlproviders/XMLAccessControl.cpp
xmlproviders/XMLCredentials.cpp
xmlproviders/XMLMetadata.cpp
xmlproviders/XMLTrust.cpp
xmlproviders/internal.h

index 335cd01..cd1f099 100644 (file)
@@ -35,7 +35,6 @@
 
 using namespace saml;
 using namespace shibboleth;
-using namespace xmlproviders;
 using namespace log4cpp;
 using namespace std;
 
@@ -328,7 +327,7 @@ FileResolver::FileResolver(const DOMElement* e)
 FileResolver::~FileResolver()
 {
     for_each(m_certs.begin(),m_certs.end(),X509_free);
-    for_each(m_xseccerts.begin(),m_xseccerts.end(),cleanup<XSECCryptoX509>);
+    for_each(m_xseccerts.begin(),m_xseccerts.end(),shibtarget::cleanup<XSECCryptoX509>());
 }
 
 void FileResolver::attach(void* ctx) const
index 4e46b41..c492d0d 100644 (file)
@@ -28,7 +28,6 @@
 
 using namespace saml;
 using namespace shibboleth;
-using namespace xmlproviders;
 using namespace log4cpp;
 using namespace std;
 
@@ -207,9 +206,9 @@ void XMLAAPImpl::init()
 XMLAAPImpl::~XMLAAPImpl()
 {
 #ifdef HAVE_GOOD_STL
-    for_each(m_attrMap.begin(),m_attrMap.end(),cleanup<xstring,AttributeRule>);
+    for_each(m_attrMap.begin(),m_attrMap.end(),shibtarget::cleanup_pair<xstring,AttributeRule>());
 #else
-    for_each(m_attrMap.begin(),m_attrMap.end(),cleanup<string,AttributeRule>);
+    for_each(m_attrMap.begin(),m_attrMap.end(),shibtarget::cleanup_pair<string,AttributeRule>());
 #endif
 }
 
index c09632f..6e451bf 100644 (file)
@@ -34,7 +34,6 @@
 using namespace saml;
 using namespace shibboleth;
 using namespace shibtarget;
-using namespace xmlproviders;
 using namespace std;
 using namespace log4cpp;
 
@@ -213,7 +212,7 @@ Operator::Operator(const DOMElement* e)
 
 Operator::~Operator()
 {
-    for_each(m_operands.begin(),m_operands.end(),cleanup<IAuthz>);
+    for_each(m_operands.begin(),m_operands.end(),shibtarget::cleanup<IAuthz>());
 }
 
 bool Operator::authorized(ShibTarget* st, ISessionCacheEntry* entry) const
index 103042e..ed91254 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <log4cpp/Category.hh>
 
-using namespace xmlproviders;
 using namespace shibboleth;
 using namespace saml;
 using namespace log4cpp;
@@ -147,7 +146,7 @@ void XMLCredentialsImpl::init()
 
 XMLCredentialsImpl::~XMLCredentialsImpl()
 {
-    for_each(m_resolverMap.begin(),m_resolverMap.end(),cleanup<string,ICredResolver>);
+    for_each(m_resolverMap.begin(),m_resolverMap.end(),shibtarget::cleanup_pair<string,ICredResolver>());
 }
 
 const ICredResolver* XMLCredentials::lookup(const char* id) const
index df03c76..23afb62 100644 (file)
@@ -40,7 +40,6 @@
 #include <xsec/framework/XSECException.hpp>
 #include <xsec/framework/XSECProvider.hpp>
 
-using namespace xmlproviders;
 using namespace shibboleth;
 using namespace saml;
 using namespace log4cpp;
@@ -599,7 +598,7 @@ XMLMetadataImpl::KeyDescriptor::KeyDescriptor(const DOMElement* e) : m_root(e),
 
 XMLMetadataImpl::KeyDescriptor::~KeyDescriptor()
 {
-    for_each(m_methods.begin(),m_methods.end(),cleanup<XENCEncryptionMethod>);
+    for_each(m_methods.begin(),m_methods.end(),shibtarget::cleanup<XENCEncryptionMethod>());
     delete m_klist;
 }
 
@@ -644,7 +643,7 @@ XMLMetadataImpl::KeyAuthority::KeyAuthority(const DOMElement* e) : m_depth(1)
 
 XMLMetadataImpl::KeyAuthority::~KeyAuthority()
 {
-    for_each(m_klists.begin(),m_klists.end(),cleanup<DSIGKeyInfoList>);
+    for_each(m_klists.begin(),m_klists.end(),shibtarget::cleanup<DSIGKeyInfoList>());
 }
 
 XMLMetadataImpl::Role::Role(const EntityDescriptor* provider, time_t validUntil, const DOMElement* e)
@@ -697,8 +696,8 @@ XMLMetadataImpl::Role::~Role()
     delete m_org;
     delete m_errorURL;
     if (m_protocolEnumCopy) XMLString::release(&m_protocolEnumCopy);
-    for_each(m_keys.begin(),m_keys.end(),cleanup<IKeyDescriptor>);
-    for_each(m_contacts.begin(),m_contacts.end(),cleanup<IContactPerson>);
+    for_each(m_keys.begin(),m_keys.end(),shibtarget::cleanup<IKeyDescriptor>());
+    for_each(m_contacts.begin(),m_contacts.end(),shibtarget::cleanup<IContactPerson>());
 }
 
 bool XMLMetadataImpl::Role::hasSupport(const XMLCh* protocol) const
@@ -828,7 +827,7 @@ XMLMetadataImpl::IDPRole::IDPRole(const EntityDescriptor* provider, time_t valid
 
 XMLMetadataImpl::IDPRole::~IDPRole()
 {
-    for_each(m_attrs.begin(),m_attrs.end(),cleanup<SAMLAttribute>);
+    for_each(m_attrs.begin(),m_attrs.end(),shibtarget::cleanup<SAMLAttribute>());
 }
 
 XMLMetadataImpl::AARole::AARole(const EntityDescriptor* provider, time_t validUntil, const DOMElement* e)
@@ -912,7 +911,7 @@ XMLMetadataImpl::AARole::AARole(const EntityDescriptor* provider, time_t validUn
 
 XMLMetadataImpl::AARole::~AARole()
 {
-    for_each(m_attrs.begin(),m_attrs.end(),cleanup<SAMLAttribute>);
+    for_each(m_attrs.begin(),m_attrs.end(),shibtarget::cleanup<SAMLAttribute>());
 }
 
 XMLMetadataImpl::EntityDescriptor::EntityDescriptor(
@@ -1054,9 +1053,9 @@ const IAttributeAuthorityDescriptor* XMLMetadataImpl::EntityDescriptor::getAttri
 XMLMetadataImpl::EntityDescriptor::~EntityDescriptor()
 {
     delete m_org;
-    for_each(m_contacts.begin(),m_contacts.end(),cleanup<IContactPerson>);
-    for_each(m_roles.begin(),m_roles.end(),cleanup<IRoleDescriptor>);
-    for_each(m_keyauths.begin(),m_keyauths.end(),cleanup<IKeyAuthority>);
+    for_each(m_contacts.begin(),m_contacts.end(),shibtarget::cleanup<IContactPerson>());
+    for_each(m_roles.begin(),m_roles.end(),shibtarget::cleanup<IRoleDescriptor>());
+    for_each(m_keyauths.begin(),m_keyauths.end(),shibtarget::cleanup<IKeyAuthority>());
 }
 
 XMLMetadataImpl::EntitiesDescriptor::EntitiesDescriptor(
@@ -1115,9 +1114,9 @@ XMLMetadataImpl::EntitiesDescriptor::EntitiesDescriptor(
 
 XMLMetadataImpl::EntitiesDescriptor::~EntitiesDescriptor()
 {
-    for_each(m_providers.begin(),m_providers.end(),cleanup<IEntityDescriptor>);
-    for_each(m_groups.begin(),m_groups.end(),cleanup<IEntitiesDescriptor>);
-    for_each(m_keyauths.begin(),m_keyauths.end(),cleanup<IKeyAuthority>);
+    for_each(m_providers.begin(),m_providers.end(),shibtarget::cleanup<IEntityDescriptor>());
+    for_each(m_groups.begin(),m_groups.end(),shibtarget::cleanup<IEntitiesDescriptor>());
+    for_each(m_keyauths.begin(),m_keyauths.end(),shibtarget::cleanup<IKeyAuthority>());
 }
 
 void XMLMetadataImpl::init()
index 94567fc..63a36c2 100644 (file)
@@ -38,7 +38,6 @@
 #include <xsec/enc/XSECCryptoException.hpp>
 #include <xsec/enc/XSECKeyInfoResolverDefault.hpp>
 
-using namespace xmlproviders;
 using namespace shibboleth;
 using namespace saml;
 using namespace log4cpp;
@@ -345,8 +344,8 @@ void XMLTrustImpl::init()
 
 XMLTrustImpl::~XMLTrustImpl()
 {
-    for_each(m_keyauths.begin(),m_keyauths.end(),cleanup<KeyAuthority>);
-    for_each(m_keybinds.begin(),m_keybinds.end(),cleanup<DSIGKeyInfoList>);
+    for_each(m_keyauths.begin(),m_keyauths.end(),shibtarget::cleanup<KeyAuthority>());
+    for_each(m_keybinds.begin(),m_keybinds.end(),shibtarget::cleanup<DSIGKeyInfoList>());
 }
 
 XMLTrust::XMLTrust(const DOMElement* e) : ReloadableXMLFile(e), m_delegate(NULL)
@@ -402,7 +401,7 @@ XMLTrust::XMLTrust(const DOMElement* e) : ReloadableXMLFile(e), m_delegate(NULL)
 XMLTrust::~XMLTrust()
 {
     delete m_delegate;
-    for_each(m_resolvers.begin(),m_resolvers.end(),cleanup<KeyInfoResolver>);
+    for_each(m_resolvers.begin(),m_resolvers.end(),shibtarget::cleanup<KeyInfoResolver>());
 }
 
 static int error_callback(int ok, X509_STORE_CTX* ctx)
index 6e18429..54b7648 100644 (file)
@@ -30,8 +30,7 @@
 # define _CRT_SECURE_NO_DEPRECATE 1
 #endif
 
-#include <saml/saml.h>
-#include <shib/shib.h>
+#include <shib-target/shib-target.h>
 #include <shib/shib-threads.h>
 #include <openssl/ssl.h>
 
@@ -218,10 +217,4 @@ public:
     };
 };
 
-namespace xmlproviders {
-    // Template cleanup functions for use with for_each algorithm
-    template<class T> void cleanup(const T* ptr) { delete const_cast<T*>(ptr); }
-    template<class A,class B> void cleanup(std::pair<A,B*> p) { delete p.second; }
-}
-
 #endif