From: Scott Cantor Date: Wed, 2 Aug 2006 23:19:55 +0000 (+0000) Subject: Blacklist groups also. X-Git-Tag: 2.0-alpha1~209 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=commitdiff_plain;h=fa5e4dad3c29ef4d01e10cc8f69327e5654732a1 Blacklist groups also. --- diff --git a/saml/saml2/metadata/impl/BlacklistMetadataFilter.cpp b/saml/saml2/metadata/impl/BlacklistMetadataFilter.cpp index a0acf60..9098acd 100644 --- a/saml/saml2/metadata/impl/BlacklistMetadataFilter.cpp +++ b/saml/saml2/metadata/impl/BlacklistMetadataFilter.cpp @@ -97,7 +97,10 @@ void BlacklistMetadataFilter::doFilter(XMLObject& xmlObject) const #endif try { - doFilter(dynamic_cast(xmlObject)); + EntitiesDescriptor& entities = dynamic_cast(xmlObject); + if (found(entities.getName())) + throw MetadataFilterException("BlacklistMetadataFilter instructed to filter the root/only group in the metadata."); + doFilter(entities); return; } catch (bad_cast) { @@ -132,7 +135,17 @@ void BlacklistMetadataFilter::doFilter(EntitiesDescriptor& entities) const } } - const vector& groups=const_cast(entities).getEntitiesDescriptors(); - for (vector::const_iterator j=groups.begin(); j!=groups.end(); j++) - doFilter(*(*j)); + VectorOf(EntitiesDescriptor) w=entities.getEntitiesDescriptors(); + for (VectorOf(EntitiesDescriptor)::size_type j=0; jgetName(); + if (found(name)) { + auto_ptr_char name2(name); + log.info("filtering out blacklisted group (%s)", name2.get()); + w.erase(w.begin() + j); + } + else { + doFilter(*(w[j])); + j++; + } + } }