IPlugIn* XMLAAPFactory(const DOMElement* e)
{
- XMLAAP* aap=new XMLAAP(e);
- try
- {
- aap->getImplementation();
- }
- catch (...)
- {
- delete aap;
- throw;
- }
- return aap;
+ auto_ptr<XMLAAP> aap(new XMLAAP(e));
+ aap->getImplementation();
+ return aap.release();
}
ReloadableXMLFileImpl* XMLAAP::newImplementation(const DOMElement* e, bool first) const
void XMLAAPImpl::init()
{
+#ifdef _DEBUG
NDC ndc("XMLAAPImpl");
+#endif
Category& log=Category::getInstance(XMLPROVIDERS_LOGCAT".XMLAAPImpl");
try
catch (SAMLException& e)
{
log.errorStream() << "Error while parsing AAP: " << e.what() << CategoryStream::ENDLINE;
- for (attrmap_t::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
- delete i->second;
+ this->~XMLAAPImpl();
throw;
}
+#ifndef _DEBUG
catch (...)
{
log.error("Unexpected error while parsing AAP");
- for (attrmap_t::iterator i=m_attrMap.begin(); i!=m_attrMap.end(); i++)
- delete i->second;
+ this->~XMLAAPImpl();
throw;
}
-
+#endif
}
XMLAAPImpl::~XMLAAPImpl()
if (log.isWarnEnabled()) {
auto_ptr_char temp(m_name);
auto_ptr_char temp2(n->getNodeValue());
- log.warn("%sattribute %svalue {%s} could not be validated by policy, rejecting it",
+ log.warn("%sattribute (%s) value {%s} could not be validated by policy, rejecting it",
(bSimple ? "" : "complex "),temp.get(),temp2.get());
}
return false;
IPlugIn* XMLCredentialsFactory(const DOMElement* e)
{
- XMLCredentials* creds=new XMLCredentials(e);
- try {
- creds->getImplementation();
- }
- catch (...) {
- delete creds;
- throw;
- }
- return creds;
+ auto_ptr<XMLCredentials> creds(new XMLCredentials(e));
+ creds->getImplementation();
+ return creds.release();
}
ReloadableXMLFileImpl* XMLCredentials::newImplementation(const char* pathname, bool first) const
void XMLCredentialsImpl::init()
{
- NDC ndc("XMLCredentialsImpl");
+#ifdef _DEBUG
+ saml::NDC ndc("XMLCredentialsImpl");
+#endif
Category& log=Category::getInstance(XMLPROVIDERS_LOGCAT".XMLCredentialsImpl");
try {
}
catch (SAMLException& e) {
log.errorStream() << "Error while parsing creds configuration: " << e.what() << CategoryStream::ENDLINE;
- for (resolvermap_t::iterator j=m_resolverMap.begin(); j!=m_resolverMap.end(); j++)
- delete j->second;
+ this->~XMLCredentialsImpl();
throw;
}
+#ifndef _DEBUG
catch (...) {
log.error("Unexpected error while parsing creds configuration");
- for (resolvermap_t::iterator j=m_resolverMap.begin(); j!=m_resolverMap.end(); j++)
- delete j->second;
+ this->~XMLCredentialsImpl();
throw;
}
+#endif
}
XMLCredentialsImpl::~XMLCredentialsImpl()
~KeyDescriptor();
KeyUse getUse() const { return m_use; }
- DSIGKeyInfoList* getKeyInfo() const { return &m_klist; }
+ DSIGKeyInfoList* getKeyInfo() const { return m_klist; }
saml::Iterator<const XENCEncryptionMethod*> getEncryptionMethods() const { return m_methods; }
const DOMElement* getElement() const { return m_root; }
private:
const DOMElement* m_root;
KeyUse m_use;
- mutable DSIGKeyInfoList m_klist;
+ mutable DSIGKeyInfoList* m_klist;
vector<const XENCEncryptionMethod*> m_methods;
};
IPlugIn* XMLMetadataFactory(const DOMElement* e)
{
- XMLMetadata* m=new XMLMetadata(e);
- try {
- m->getImplementation();
- }
- catch (...) {
- delete m;
- throw;
- }
- return m;
+ auto_ptr<XMLMetadata> m(new XMLMetadata(e));
+ m->getImplementation();
+ return m.release();
}
ReloadableXMLFileImpl* XMLMetadata::newImplementation(const DOMElement* e, bool first) const
else if (!XMLString::compareString(e->getAttributeNS(NULL,SHIB_L(use)),SHIB_L(signing)))
m_use=signing;
+ m_klist = new DSIGKeyInfoList(NULL);
+
// Process ds:KeyInfo
e=saml::XML::getFirstChildElement(e);
DOMElement* child=saml::XML::getFirstChildElement(e);
while (child) {
try {
- if (!m_klist.addXMLKeyInfo(child)) {
+ if (!m_klist->addXMLKeyInfo(child)) {
Category::getInstance(XMLPROVIDERS_LOGCAT".XMLMetadataImpl.KeyDescriptor").warn(
"skipped unsupported ds:KeyInfo child element");
}
{
for (vector<const XENCEncryptionMethod*>::iterator i=m_methods.begin(); i!=m_methods.end(); i++)
delete const_cast<XENCEncryptionMethod*>(*i);
+ delete m_klist;
}
XMLMetadataImpl::Role::Role(const EntityDescriptor* provider, time_t validUntil, const DOMElement* e)
void XMLMetadataImpl::init()
{
+#ifdef _DEBUG
NDC ndc("XMLMetadataImpl");
+#endif
Category& log=Category::getInstance(XMLPROVIDERS_LOGCAT".XMLMetadataImpl");
try
this->~XMLMetadataImpl();
throw;
}
+#ifndef _DEBUG
catch (...)
{
log.error("Unexpected error while parsing SAML metadata");
this->~XMLMetadataImpl();
throw;
}
+#endif
}
XMLMetadataImpl::~XMLMetadataImpl()
IPlugIn* XMLRevocationFactory(const DOMElement* e)
{
- XMLRevocation* r=new XMLRevocation(e);
- try {
- r->getImplementation();
- }
- catch (...) {
- delete r;
- throw;
- }
- return r;
+ auto_ptr<XMLRevocation> r(new XMLRevocation(e));
+ r->getImplementation();
+ return r.release();
}
void XMLRevocationImpl::init()
{
- NDC ndc("XMLRevocationImpl");
+#ifdef _DEBUG
+ saml::NDC ndc("XMLRevocationImpl");
+#endif
Category& log=Category::getInstance(XMLPROVIDERS_LOGCAT".XMLRevocationImpl");
try {
}
catch (SAMLException& e) {
log.errorStream() << "Error while parsing revocation configuration: " << e.what() << CategoryStream::ENDLINE;
- for (vector<KeyAuthority*>::iterator i=m_keyauths.begin(); i!=m_keyauths.end(); i++)
- delete (*i);
+ this->~XMLRevocationImpl();
throw;
}
+#ifndef _DEBUG
catch (...) {
log.error("Unexpected error while parsing revocation configuration");
- for (vector<KeyAuthority*>::iterator i=m_keyauths.begin(); i!=m_keyauths.end(); i++)
- delete (*i);
+ this->~XMLRevocationImpl();
throw;
}
+#endif
}
XMLRevocationImpl::~XMLRevocationImpl()
IPlugIn* XMLTrustFactory(const DOMElement* e)
{
- XMLTrust* t=new XMLTrust(e);
- try {
- t->getImplementation();
- }
- catch (...) {
- delete t;
- throw;
- }
- return t;
+ auto_ptr<XMLTrust> t(new XMLTrust(e));
+ t->getImplementation();
+ return t.release();
}
void XMLTrustImpl::init()
{
- NDC ndc("XMLTrustImpl");
+#ifdef _DEBUG
+ saml::NDC ndc("XMLTrustImpl");
+#endif
Category& log=Category::getInstance(XMLPROVIDERS_LOGCAT".XMLTrustImpl");
try {
}
catch (SAMLException& e) {
log.errorStream() << "Error while parsing trust configuration: " << e.what() << CategoryStream::ENDLINE;
- for (vector<KeyAuthority*>::iterator i=m_keyauths.begin(); i!=m_keyauths.end(); i++)
- delete (*i);
- for (vector<DSIGKeyInfoList*>::iterator j=m_keybinds.begin(); j!=m_keybinds.end(); j++)
- delete (*j);
+ this->~XMLTrustImpl();
throw;
}
+#ifndef _DEBUG
catch (...) {
log.error("Unexpected error while parsing trust configuration");
- for (vector<KeyAuthority*>::iterator i=m_keyauths.begin(); i!=m_keyauths.end(); i++)
- delete (*i);
- for (vector<DSIGKeyInfoList*>::iterator j=m_keybinds.begin(); j!=m_keybinds.end(); j++)
- delete (*j);
+ this->~XMLTrustImpl();
throw;
}
+#endif
}
XMLTrustImpl::~XMLTrustImpl()
log.warn("failed to add CRL");
}
}
+
+ // Install error callback.
+ X509_STORE_CTX_set_verify_cb(ctx,logging_callback);
int result=X509_verify_cert(ctx);
sk_X509_pop_free(chain,X509_free);