From 6bebd3babf5a3d365bdfe834ddab0e03f3596ced Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Thu, 6 Sep 2012 16:28:45 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/SSPCPP-498 --- config_win32.h | 6 +++--- configure.ac | 2 +- cpp-xmltooling.sln | 4 ++-- xmltooling/Makefile.am | 4 ++-- xmltooling/util/ParserPool.cpp | 30 ++++++++++++++++++++++-------- xmltooling/util/PathResolver.cpp | 9 ++++++++- xmltooling/version.h | 2 +- xmltooling/xmltooling.rc | 4 ++-- 8 files changed, 41 insertions(+), 20 deletions(-) diff --git a/config_win32.h b/config_win32.h index 29f3446..0337856 100644 --- a/config_win32.h +++ b/config_win32.h @@ -114,13 +114,13 @@ #define PACKAGE_NAME "xmltooling" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "xmltooling 1.5.0" +#define PACKAGE_STRING "xmltooling 1.5.1" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "xmltooling" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.5.0" +#define PACKAGE_VERSION "1.5.1" /* Define to the necessary symbol if this constant uses a non-standard name on your system. */ @@ -133,7 +133,7 @@ /* #undef TM_IN_SYS_TIME */ /* Version number of package */ -#define VERSION "1.5.0" +#define VERSION "1.5.1" /* Define if you wish to disable XML-Security-dependent features. */ /* #undef XMLTOOLING_NO_XMLSEC */ diff --git a/configure.ac b/configure.ac index 7d6c6b7..47d7da0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # Process this file with autoreconf AC_PREREQ([2.50]) -AC_INIT([xmltooling],[1.5.0],[https://issues.shibboleth.net/],[xmltooling]) +AC_INIT([xmltooling],[1.5.1],[https://issues.shibboleth.net/],[xmltooling]) AC_CONFIG_SRCDIR(xmltooling) AC_CONFIG_AUX_DIR(build-aux) AC_CONFIG_MACRO_DIR(m4) diff --git a/cpp-xmltooling.sln b/cpp-xmltooling.sln index cdd98dd..7b85cf3 100644 --- a/cpp-xmltooling.sln +++ b/cpp-xmltooling.sln @@ -1,6 +1,6 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{61BF324D-2532-49C9-93CE-DF0E89529D4F}" ProjectSection(SolutionItems) = preProject m4\acinclude.m4 = m4\acinclude.m4 diff --git a/xmltooling/Makefile.am b/xmltooling/Makefile.am index f162795..d3e49dc 100644 --- a/xmltooling/Makefile.am +++ b/xmltooling/Makefile.am @@ -204,13 +204,13 @@ common_sources = \ libxmltooling_lite_la_SOURCES = \ ${common_sources} libxmltooling_lite_la_CPPFLAGS = -DXMLTOOLING_LITE -libxmltooling_lite_la_LDFLAGS = -version-info 6:0:0 +libxmltooling_lite_la_LDFLAGS = -version-info 6:1:0 if BUILD_XMLSEC libxmltooling_la_SOURCES = \ ${common_sources} \ ${xmlsec_sources} -libxmltooling_la_LDFLAGS = $(XMLSEC_LIBS) -version-info 6:0:0 +libxmltooling_la_LDFLAGS = $(XMLSEC_LIBS) -version-info 6:1:0 endif install-exec-hook: diff --git a/xmltooling/util/ParserPool.cpp b/xmltooling/util/ParserPool.cpp index 3650297..1176617 100644 --- a/xmltooling/util/ParserPool.cpp +++ b/xmltooling/util/ParserPool.cpp @@ -229,8 +229,13 @@ bool ParserPool::loadSchema(const XMLCh* nsURI, const XMLCh* pathname) return false; } + // Roundtrip to local code page and back to translate path as needed. + string topath(p.get()); + XMLToolingConfig::getConfig().getPathResolver()->resolve(topath, PathResolver::XMLTOOLING_XML_FILE); + auto_ptr_XMLCh temp(topath.c_str()); + Lock lock(m_lock); - m_schemaLocMap[nsURI]=pathname; + m_schemaLocMap[nsURI] = temp.get(); m_schemaLocations.erase(); for_each(m_schemaLocMap.begin(), m_schemaLocMap.end(), doubleit(m_schemaLocations,chSpace)); @@ -251,7 +256,9 @@ bool ParserPool::loadCatalogs(const char* pathnames) bool ParserPool::loadCatalog(const char* pathname) { - auto_ptr_XMLCh temp(pathname); + string p(pathname); + XMLToolingConfig::getConfig().getPathResolver()->resolve(p, PathResolver::XMLTOOLING_XML_FILE); + auto_ptr_XMLCh temp(p.c_str()); return loadCatalog(temp.get()); } @@ -300,13 +307,20 @@ bool ParserPool::loadCatalog(const XMLCh* pathname) } // Fetch all the elements. - DOMNodeList* mappings=root->getElementsByTagNameNS(CATALOG_NS,system); + DOMNodeList* mappings = root->getElementsByTagNameNS(CATALOG_NS,system); Lock lock(m_lock); - for (XMLSize_t i=0; igetLength(); i++) { - root=static_cast(mappings->item(i)); - const XMLCh* from=root->getAttributeNS(nullptr,systemId); - const XMLCh* to=root->getAttributeNS(nullptr,uri); - m_schemaLocMap[from]=to; + for (XMLSize_t i = 0; i < mappings->getLength(); i++) { + root = static_cast(mappings->item(i)); + const XMLCh* from = root->getAttributeNS(nullptr,systemId); + const XMLCh* to = root->getAttributeNS(nullptr,uri); + + // Roundtrip to local code page and back to translate path as needed. + auto_ptr_char temp(to); + string topath(temp.get()); + XMLToolingConfig::getConfig().getPathResolver()->resolve(topath, PathResolver::XMLTOOLING_XML_FILE); + auto_ptr_XMLCh temp2(topath.c_str()); + + m_schemaLocMap[from] = temp2.get(); } m_schemaLocations.erase(); for_each(m_schemaLocMap.begin(), m_schemaLocMap.end(), doubleit(m_schemaLocations,chSpace)); diff --git a/xmltooling/util/PathResolver.cpp b/xmltooling/util/PathResolver.cpp index 1436e99..122561e 100644 --- a/xmltooling/util/PathResolver.cpp +++ b/xmltooling/util/PathResolver.cpp @@ -28,6 +28,10 @@ #include "exceptions.h" #include "util/PathResolver.h" +#ifdef WIN32 +# include +#endif + using namespace xmltooling; using namespace std; @@ -106,7 +110,10 @@ const string& PathResolver::resolve(string& s, file_type_t filetype, const char* if (s.find('%') != string::npos) { // This is an ugly workaround for Windows XP/2003, which don't support the PROGRAMDATA variable. if (!getenv("PROGRAMDATA") && s.find("%PROGRAMDATA%") != string::npos) { - s.replace(s.find("%PROGRAMDATA%"), 13, "%ALLUSERSPROFILE%/Application Data"); + char appdatapath[MAX_PATH + 2]; + if (SHGetFolderPath(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, appdatapath) == S_OK) { + s.replace(s.find("%PROGRAMDATA%"), 13, appdatapath); + } } char expbuf[MAX_PATH + 2]; DWORD cnt = ExpandEnvironmentStrings(s.c_str(), expbuf, sizeof(expbuf)); diff --git a/xmltooling/version.h b/xmltooling/version.h index 6261811..2841b3e 100644 --- a/xmltooling/version.h +++ b/xmltooling/version.h @@ -44,7 +44,7 @@ #define XMLTOOLING_VERSION_MAJOR 1 #define XMLTOOLING_VERSION_MINOR 5 -#define XMLTOOLING_VERSION_REVISION 0 +#define XMLTOOLING_VERSION_REVISION 1 /** DO NOT MODIFY BELOW THIS LINE */ diff --git a/xmltooling/xmltooling.rc b/xmltooling/xmltooling.rc index c49352b..8d4a5ca 100644 --- a/xmltooling/xmltooling.rc +++ b/xmltooling/xmltooling.rc @@ -28,7 +28,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,5,0,0 + FILEVERSION 1,5,1,0 PRODUCTVERSION 2,5,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -51,7 +51,7 @@ BEGIN #else VALUE "FileDescription", "OpenSAML XMLTooling Library\0" #endif - VALUE "FileVersion", "1, 5, 0, 0\0" + VALUE "FileVersion", "1, 5, 1, 0\0" #ifdef XMLTOOLING_LITE #ifdef _DEBUG VALUE "InternalName", "xmltooling-lite1_5D\0" -- 2.1.4