X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=xmltooling%2Futil%2FParserPool.cpp;h=f6bc3694540c7c2dd96467e8370cbaa002a3c18c;hb=6927b8951eb7d206a016c737a2e9ae5dfed47f0c;hp=11766174cf067ca32912222a3879c7701200627a;hpb=6bebd3babf5a3d365bdfe834ddab0e03f3596ced;p=shibboleth%2Fcpp-xmltooling.git diff --git a/xmltooling/util/ParserPool.cpp b/xmltooling/util/ParserPool.cpp index 1176617..f6bc369 100644 --- a/xmltooling/util/ParserPool.cpp +++ b/xmltooling/util/ParserPool.cpp @@ -104,7 +104,17 @@ namespace { ParserPool::ParserPool(bool namespaceAware, bool schemaAware) - : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()), m_security(new SecurityManager()) {} + : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()), m_security(new SecurityManager()) { + + int expLimit = 0; + const char* env = getenv("XMLTOOLING_ENTITY_EXPANSION_LIMIT"); + if (env) { + expLimit = atoi(env); + } + if (expLimit <= 0) + expLimit = XMLTOOLING_ENTITY_EXPANSION_LIMIT; + m_security->setEntityExpansionLimit(expLimit); +} ParserPool::~ParserPool() { @@ -247,10 +257,8 @@ bool ParserPool::loadCatalogs(const char* pathnames) string temp(pathnames); vector catpaths; split(catpaths, temp, is_any_of(PATH_SEPARATOR_STR), algorithm::token_compress_on); - for (vector::iterator i = catpaths.begin(); i != catpaths.end(); ++i) { - XMLToolingConfig::getConfig().getPathResolver()->resolve(*i, PathResolver::XMLTOOLING_XML_FILE); - loadCatalog(i->c_str()); - } + static bool (ParserPool::* lc)(const char*) = &ParserPool::loadCatalog; + for_each(catpaths.begin(), catpaths.end(), boost::bind(lc, this, boost::bind(&string::c_str, _1))); return !catpaths.empty(); }