From: Scott Cantor Date: Thu, 13 Aug 2009 18:44:45 +0000 (+0000) Subject: Apply manual validators even when schema was used. X-Git-Tag: 2.2.1~1 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=1eec8cff8b46eeea53865cfcfa887c5ac24d1f35 Apply manual validators even when schema was used. --- diff --git a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp index 47106ec..44fdeac 100644 --- a/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/DynamicMetadataProvider.cpp @@ -112,14 +112,13 @@ pair DynamicMetadataProvider::get } } - if (!m_validate) { - try { - SchemaValidators.validate(entity2.get()); - } - catch (exception& ex) { - log.error("metadata intance failed manual schema validation checking: %s", ex.what()); - throw MetadataException("Metadata instance failed manual schema validation checking."); - } + // Preprocess the metadata (even if we schema-validated). + try { + SchemaValidators.validate(entity2.get()); + } + catch (exception& ex) { + log.error("metadata intance failed manual validation checking: %s", ex.what()); + throw MetadataException("Metadata instance failed manual validation checking."); } // Filter it, which may throw. diff --git a/saml/saml2/metadata/impl/XMLMetadataProvider.cpp b/saml/saml2/metadata/impl/XMLMetadataProvider.cpp index 1809d3d..0dbc9c7 100644 --- a/saml/saml2/metadata/impl/XMLMetadataProvider.cpp +++ b/saml/saml2/metadata/impl/XMLMetadataProvider.cpp @@ -101,16 +101,15 @@ pair XMLMetadataProvider::load() "Root of metadata instance not recognized: $1", params(1,xmlObject->getElementQName().toString().c_str()) ); - // Preprocess the metadata. - if (!m_validate) { - try { - SchemaValidators.validate(xmlObject.get()); - } - catch (exception& ex) { - m_log.error("metadata intance failed manual schema validation checking: %s", ex.what()); - throw MetadataException("Metadata instance failed manual schema validation checking."); - } + // Preprocess the metadata (even if we schema-validated). + try { + SchemaValidators.validate(xmlObject.get()); } + catch (exception& ex) { + m_log.error("metadata intance failed manual validation checking: %s", ex.what()); + throw MetadataException("Metadata instance failed manual validation checking."); + } + doFilters(*xmlObject.get()); xmlObject->releaseThisAndChildrenDOM(); xmlObject->setDocument(NULL);