</scannerInfoProvider>\r
</profile>\r
</storageModule>\r
+\r
+<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.943130369" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig">\r
+<externalSettings/>\r
+<extensions>\r
+<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/>\r
+<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>\r
+<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>\r
+</extensions>\r
+</storageModule>\r
<storageModule moduleId="org.eclipse.cdt.core.pathentry">\r
+<pathentry include="C:/log4shib-1.0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/xerces-c_2_8_0-x86-windows-vc_8_0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/xml-security-c-1.4.0/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/openssl-0.9.8g/inc32" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/curl-7.17.1/include" kind="inc" path="" system="true"/>\r
+<pathentry include="C:/cxxtest" kind="inc" path="" system="true"/>\r
+<pathentry base-path="cpp-xmltooling" include="" kind="inc" path="" system="true"/>\r
+<pathentry base-path="cpp-xmltooling" include="xmltooling" kind="inc" path="" system="true"/>\r
+<pathentry kind="mac" name="_MSC_VER" path="" value=""/>\r
+<pathentry kind="mac" name="WIN32" path="" value=""/>\r
<pathentry kind="out" path="xmltooling/Debug"/>\r
<pathentry kind="out" path="xmltoolingtest/Debug"/>\r
<pathentry kind="out" path="debug"/>\r
<pathentry kind="src" path="xmltooling/util"/>\r
<pathentry kind="src" path="xmltooling/validation"/>\r
<pathentry kind="src" path="xmltoolingtest"/>\r
-<pathentry include="C:/log4cpp-0.3.5rc1/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/xerces-c2_7_0-win32/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/xml-security-c-1.2.0/include" kind="inc" path="" system="true"/>\r
-<pathentry include="C:/cxxtest" kind="inc" path="" system="true"/>\r
-<pathentry base-path="XMLTooling-C" include="" kind="inc" path="" system="true"/>\r
-<pathentry base-path="XMLTooling-C" include="xmltooling" kind="inc" path="" system="true"/>\r
-<pathentry kind="mac" name="_MSC_VER" path="" value=""/>\r
-<pathentry kind="mac" name="WIN32" path="" value=""/>\r
-</storageModule>\r
-<storageModule buildSystemId="org.eclipse.cdt.core.defaultConfigDataProvider" id="converted.config.943130369" moduleId="org.eclipse.cdt.core.settings" name="convertedConfig">\r
-<externalSettings/>\r
-<extensions>\r
-<extension id="org.eclipse.cdt.core.nullindexer" point="org.eclipse.cdt.core.CIndexer"/>\r
-<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>\r
-<extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>\r
-</extensions>\r
</storageModule>\r
+<storageModule moduleId="org.eclipse.cdt.core.language.mapping"/>\r
+<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>\r
</cconfiguration>\r
</storageModule>\r
</cproject>\r
dist-hook:
rm -rf `find $(distdir)/xmltoolingtest/data -name .svn`
+ rm -rf `find $(distdir)/doc/api -name .svn`
SUBDIRS = doc schemas xmltooling xmltoolingtest
xmltooling.spec \
pkginfo.in \
pkginfo \
- checkinstall
+ depend \
+ postinstall
DISTCLEANFILES = xmltooling.spec pkginfo
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
- *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
+ *-osf* | *-hpux*) flag="-D_REENTRANT";;
+ *solaris*)
+ if test "$GCC" = "yes"; then
+ flag="-D_REENTRANT"
+ else
+ flag="-mt -D_REENTRANT"
+ fi
+ ;;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
+++ /dev/null
-#!/bin/sh\r
-\r
-expected_platform="sparc"\r
-platform=`uname -p`\r
-if [ ${platform} != ${expected_platform} ]; then\r
- echo "This package must be installed on ${expected_platform}"\r
- exit 1\r
-fi\r
-exit 0\r
specialization. */
#define HAVE_GOOD_STL 1
+/* Define to 1 if you have an STL implementation that supports
+ std::iterator_traits. */
+#define HAVE_ITERATOR_TRAITS 1
+
/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */
if test -f "${LOG4SHIB_CONFIG}"; then
LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
- AC_CHECK_HEADER([log4shib/Category.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
+ AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
AC_TRY_LINK(
- [#include <log4shib/Category.hh>],
- [log4shib::Category::getInstance("foo")],
+ [#include <log4shib/Category.hh>
+#include <log4shib/CategoryStream.hh>],
+ [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol],
[AC_DEFINE(XMLTOOLING_LOG4SHIB,1,[Define if log4shib library is used.])],
[AC_MSG_ERROR([unable to link with log4shib])])
else
AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
- AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
- AC_CHECK_HEADER([log4cpp/PropertyConfigurator.hh],,AC_MSG_ERROR([you need at least log4cpp 0.3.x]))
+ AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
AC_TRY_LINK(
- [#include <log4cpp/Category.hh>],
- [log4cpp::Category::getInstance("foo")],
+ [#include <log4cpp/Category.hh>
+#include <log4cpp/CategoryStream.hh>],
+ [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol],
[AC_DEFINE(XMLTOOLING_LOG4CPP,1,[Define if log4cpp library is used.])],
- [AC_MSG_ERROR([unable to link with log4cpp])])
+ [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
else
AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
fi
AC_MSG_CHECKING([XML-Security version])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
- [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3) || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM == 3 && XSEC_VERSION_MINOR > 0)
+ [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
int i = 0;
#else
-#error need version 1.3.1 or later
+#error need version 1.4.0 or later
#endif])],
[AC_MSG_RESULT(OK)],
- [AC_MSG_FAILURE([XML-Security version 1.3.1 or greater is required.])])
+ [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
AC_TRY_LINK(
[#include <xsec/utils/XSECPlatformUtils.hpp>],
[XSECPlatformUtils::Initialise()],,
- [AC_MSG_ERROR([unable to link with XML-Sec])])
+ [AC_MSG_ERROR([unable to link with XML-Security])])
# restore master libs
LIBS="$save_LIBS"
- AC_LANG(C)
-
# libcurl settings
AC_PATH_PROG(CURL_CONFIG,curl-config)
AC_ARG_WITH(curl,
AC_ARG_WITH(openssl,
AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
[if test x_$with_openssl != x_/usr; then
- SSLFLAGS="-I${with_openssl}/include"
+ SSLFLAGS="-I${with_openssl}/include"
SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
+ else
+ SSLLIBS="-lcrypto -lssl"
fi])
if test "x$SSLLIBS" = "x" ; then
LIBS="$save_LIBS"
AC_SUBST(XMLSEC_LIBS)
-
- AC_LANG(C++)
else
AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
AC_DEFINE(XMLTOOLING_NO_XMLSEC,1,
[AC_DEFINE(HAVE_GOOD_STL,1,
[Define if you have an STL implementation that supports useful string specialization.])],
)
+AC_TRY_LINK(
+ [#include <vector>],
+ [std::iterator_traits<std::vector<int>::iterator>::value_type foo=0],
+ [AC_DEFINE(HAVE_ITERATOR_TRAITS,1,
+ [Define to 1 if you have an STL implementation that supports std::iterator_traits.])],
+ )
# Check for unit test support
CXXTEST="/usr/bin/cxxtestgen.pl"
--- /dev/null
+P SHIBossl OpenSSL\r
+ 0.9.8g\r
+P SHIBxerces xerces-c\r
+ 2.8.0\r
+P SHIBxmlsec xml-security-c\r
+ 1.4.0\r
pkgdoc_DATA = $(docfiles)
-EXTRA_DIST = $(docfiles)
+EXTRA_DIST = $(docfiles) api
-ARCH=sparc\r
PKG=SHIBxmltool\r
-NAME=XML Tooling Library for C++\r
+ARCH=sparc\r
VERSION=@-VERSION-@\r
-CATEGORY=system\r
-VENDOR=http://www.opensaml.org/ packaged for Shibboleth by Scott Cantor\r
-HOTLINE=http://bugzilla.internet2.edu/\r
-EMAIL=cantor.2@osu.edu\r
-PSTAMP=1May2006\r
+BASEDIR=/usr/local\r
+NAME=xmltooling-c\r
+CATEGORY=application,textproc,security\r
+DESC=Library for DOM processing with Signature/Encryption for C++\r
+VENDOR=Internet2\r
+HOTLINE=https://bugs.internet2.edu/\r
CLASSES=none\r
+PSTAMP=sunra.internet2.edu 2007-11-15\r
+EMAIL=cantor.2@osu.edu\r
--- /dev/null
+#!/bin/sh\r
+\r
+cd ${CLIENT_BASEDIR}/share/xml/xmltooling\r
+\r
+sed "s|uri=\".*${CLIENT_BASEDIR}|uri=\"${CLIENT_BASEDIR}|1" catalog.xml > catalog.xml.tmp\r
+mv catalog.xml.tmp catalog.xml\r
+chmod 644 catalog.xml\r
+\r
+exit 0\r
<element name="CanonicalizationMethod" type="ds:CanonicalizationMethodType"/> \r
<complexType name="CanonicalizationMethodType" mixed="true">\r
<sequence>\r
- <any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>\r
+ <any namespace="##any" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>\r
<!-- (0,unbounded) elements from (1,1) namespace -->\r
</sequence>\r
<attribute name="Algorithm" type="anyURI" use="required"/> \r
<complexType name="SignatureMethodType" mixed="true">\r
<sequence>\r
<element name="HMACOutputLength" minOccurs="0" type="ds:HMACOutputLengthType"/>\r
- <any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>\r
+ <any namespace="##other" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>\r
<!-- (0,unbounded) elements from (1,1) external namespace -->\r
</sequence>\r
<attribute name="Algorithm" type="anyURI" use="required"/> \r
Name: xmltooling
Summary: Open source XMLTooling library
Version: @-VERSION-@
-Release: 3
+Release: 5
Group: System Environment/Libraries
Vendor: Internet2
License: Apache 2.0
URL: http://www.opensaml.org/
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
-BuildRequires: xerces%{?xercesver}-c-devel >= 2.6.1
+BuildRequires: xerces%{?xercesver}-c-devel >= 2.8.0
BuildRequires: xml-security-c-devel >= 1.4.0
-BuildRequires: openssl-devel, cxxtest
-%{?_with_log4cpp:BuildRequires: log4cpp-devel >= 0.3.5}
+BuildRequires: openssl-devel, curl-devel >= 7.10.6
+%{?_with_log4cpp:BuildRequires: log4cpp-devel >= 1.0}
%{!?_with_log4cpp:BuildRequires: log4shib-devel}
%description
%install
[ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
%{__make} install DESTDIR=$RPM_BUILD_ROOT
+find $RPM_BUILD_ROOT/%{_bindir} -type f |
+ %{__sed} -e "s|$RPM_BUILD_ROOT||" | sort > rpm.binlist
%check || :
%{__make} check
%postun -p /sbin/ldconfig
%endif
-%files
+%files -f rpm.binlist
%defattr(-,root,root,-)
%{_libdir}/libxmltooling.so.*
%{_libdir}/libxmltooling-lite.so.*
%dir %{_datadir}/xml/xmltooling
%{_datadir}/xml/xmltooling
-%exclude %{_bindir}/xmltoolingtest
%docdir %{_datadir}/doc/xmltooling
%{_datadir}/doc/xmltooling/LICENSE.txt
%{_datadir}/doc/xmltooling/NOTICE.txt
%doc %{_datadir}/doc/xmltooling/api
%changelog
+* Fri Jan 18 2008 Scott Cantor <cantor.2@osu.edu> - 1.0-5
+- Release candidate 1.
+
+* Thu Nov 08 2007 Scott Cantor <cantor.2@osu.edu> - 1.0-4
+- Second public beta.
+
* Thu Aug 16 2007 Scott Cantor <cantor.2@osu.edu> - 1.0-3
- First public beta.
if (i!=m_attributeMap.end()) {
releaseThisandParentDOM();
XMLString::release(&(i->second));
- if (value) {
+ if (value && *value) {
i->second=XMLString::replicate(value);
+ if (ID)
+ m_idAttribute=i;
}
else {
if (m_idAttribute==i)
m_idAttribute=m_attributeMap.end();
m_attributeMap.erase(i);
}
-
- if (ID) {
- m_idAttribute=i;
- }
}
- else if (value) {
+ else if (value && *value) {
releaseThisandParentDOM();
m_attributeMap[qualifiedName]=XMLString::replicate(value);
- if (ID) {
+ if (ID)
m_idAttribute = m_attributeMap.find(qualifiedName);
- }
}
}
soap/OpenSSLSOAPTransport.h
utilinclude_HEADERS = \
+ util/CurlNetAccessor.hpp \
+ util/CurlURLInputStream.hpp \
util/DateTime.h \
util/NDC.h \
util/ParserPool.h \
+ util/Predicates.h \
util/ReloadableXMLFile.h \
util/ReplayCache.h \
util/StorageService.h \
signature/impl/SignatureValidator.cpp \
signature/impl/XMLSecSignatureImpl.cpp \
soap/impl/CURLSOAPTransport.cpp \
+ util/CurlNetAccessor.cpp \
+ util/CurlURLInputStream.cpp \
util/ReplayCache.cpp \
util/StorageService.cpp
impl/UnknownElement.cpp \
io/AbstractXMLObjectMarshaller.cpp \
io/AbstractXMLObjectUnmarshaller.cpp \
+ io/HTTPRequest.cpp \
signature/impl/KeyInfoImpl.cpp \
signature/impl/KeyInfoSchemaValidators.cpp \
soap/impl/SOAPClient.cpp \
bool xmltooling::operator==(const Namespace& op1, const Namespace& op2)
{
+ if (&op1 == &op2)
+ return true;
return (XMLString::equals(op1.getNamespaceURI(),op2.getNamespaceURI()) &&
XMLString::equals(op1.getNamespacePrefix(),op2.getNamespacePrefix()));
}
bool xmltooling::operator==(const QName& op1, const QName& op2)
{
+ if (&op1 == &op2)
+ return true;
return (!XMLString::compareString(op1.getNamespaceURI(),op2.getNamespaceURI()) &&
!XMLString::compareString(op1.getLocalPart(),op2.getLocalPart()));
}
#endif
XMLPlatformUtils::Initialize();
- log.debug("Xerces initialization complete");
+ log.debug("Xerces %s initialization complete", XERCES_FULLVERSIONDOT);
#ifndef XMLTOOLING_NO_XMLSEC
XSECPlatformUtils::Initialise();
m_xsecProvider=new XSECProvider();
- log.debug("XMLSec initialization complete");
+ log.debug("XML-Security %s initialization complete", XSEC_FULLVERSIONDOT);
#endif
m_parserPool=new ParserPool();
# endif
#endif
- log.info("library initialization complete");
+ log.info("%s library initialization complete", PACKAGE_STRING);
return true;
}
#ifdef _DEBUG
xmltooling::NDC ndc("term");
#endif
- Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig").info("library shutdown complete");
+ Category::getInstance(XMLTOOLING_LOGCAT".XMLToolingConfig").info("%s library shutdown complete", PACKAGE_STRING);
}
Lockable* XMLToolingInternalConfig::lock()
unsigned long code=ERR_get_error_line_data(&file,&line,&data,&flags);
while (code) {
Category& log=Category::getInstance("OpenSSL");
- log.errorStream() << "error code: " << code << " in " << file << ", line " << line << CategoryStream::ENDLINE;
+ log.errorStream() << "error code: " << code << " in " << file << ", line " << line << logging::eol;
if (data && (flags & ERR_TXT_STRING))
- log.errorStream() << "error data: " << data << CategoryStream::ENDLINE;
+ log.errorStream() << "error data: " << data << logging::eol;
code=ERR_get_error_line_data(&file,&line,&data,&flags);
}
}
#define END_XMLOBJECT }
/**
+ * Declares a static variable holding the XMLObject's element QName.
+ */
+#define DECL_ELEMENT_QNAME \
+ public: \
+ XMLTOOLING_DOXYGEN(Element QName) \
+ static xmltooling::QName ELEMENT_QNAME
+
+/**
+ * Declares a static variable holding the XMLObject's schema type QName.
+ */
+#define DECL_TYPE_QNAME \
+ public: \
+ XMLTOOLING_DOXYGEN(Type QName) \
+ static xmltooling::QName TYPE_QNAME
+
+/**
+ * Implements a static variable holding an XMLObject's element QName.
+ *
+ * @param cname the name of the XMLObject specialization
+ * @param namespaceURI the XML namespace of the default associated element
+ * @param namespacePrefix the XML namespace prefix of the default associated element
+ */
+#define IMPL_ELEMENT_QNAME(cname,namespaceURI,namespacePrefix) \
+ xmltooling::QName cname::ELEMENT_QNAME(namespaceURI,cname::LOCAL_NAME,namespacePrefix)
+
+/**
+ * Implements a static variable holding an XMLObject's schema type QName.
+ *
+ * @param cname the name of the XMLObject specialization
+ * @param namespaceURI the XML namespace of the default associated element
+ * @param namespacePrefix the XML namespace prefix of the default associated element
+ */
+#define IMPL_TYPE_QNAME(cname,namespaceURI,namespacePrefix) \
+ xmltooling::QName cname::TYPE_QNAME(namespaceURI,cname::TYPE_NAME,namespacePrefix)
+
+/**
* Declares abstract set method for a typed XML attribute.
* The get method is omitted.
*
* @param namespaceURI the XML namespace of the attribute
*/
#define MARSHALL_STRING_ATTRIB(proper,ucase,namespaceURI) \
- if (m_##proper) { \
+ if (m_##proper && *m_##proper) { \
domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
}
* @param namespaceURI the XML namespace of the attribute
*/
#define MARSHALL_INTEGER_ATTRIB(proper,ucase,namespaceURI) \
- if (m_##proper) { \
+ if (m_##proper && *m_##proper) { \
domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
}
* @param namespaceURI the XML namespace of the attribute
*/
#define MARSHALL_ID_ATTRIB(proper,ucase,namespaceURI) \
- if (m_##proper) { \
+ if (m_##proper && *m_##proper) { \
domElement->setAttributeNS(namespaceURI, ucase##_ATTRIB_NAME, m_##proper); \
domElement->setIdAttributeNS(namespaceURI, ucase##_ATTRIB_NAME); \
}
#define PROC_TYPED_CHILD(proper,namespaceURI,force) \
if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
proper* typesafe=dynamic_cast<proper*>(childXMLObject); \
- if (typesafe) { \
- set##proper(typesafe); \
+ if (typesafe && !m_##proper) { \
+ typesafe->setParent(this); \
+ *m_pos_##proper = m_##proper = typesafe; \
return; \
} \
}
#define PROC_TYPED_FOREIGN_CHILD(proper,ns,namespaceURI,force) \
if (force || xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,ns::proper::LOCAL_NAME)) { \
ns::proper* typesafe=dynamic_cast<ns::proper*>(childXMLObject); \
- if (typesafe) { \
- set##proper(typesafe); \
+ if (typesafe && !m_##proper) { \
+ typesafe->setParent(this); \
+ *m_pos_##proper = m_##proper = typesafe; \
return; \
} \
}
*/
#define PROC_XMLOBJECT_CHILD(proper,namespaceURI) \
if (xmltooling::XMLHelper::isNodeNamed(root,namespaceURI,proper::LOCAL_NAME)) { \
- set##proper(childXMLObject); \
- return; \
+ if (!m_##proper) { \
+ childXMLObject->setParent(this); \
+ *m_pos_##proper = m_##proper = childXMLObject; \
+ return; \
+ } \
}
/**
#define DECL_INTEGER_CONTENT(proper) \
XMLTOOLING_DOXYGEN(Returns proper in integer form after a NULL indicator.) \
std::pair<bool,int> get##proper() const { \
- return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : NULL)); \
+ return std::make_pair((getTextContent()!=NULL), (getTextContent()!=NULL ? xercesc::XMLString::parseInt(getTextContent()) : 0)); \
} \
XMLTOOLING_DOXYGEN(Sets proper.) \
void set##proper(int proper) { \
specialization. */
#undef HAVE_GOOD_STL
+/* Define to 1 if you have an STL implementation that supports
+ std::iterator_traits. */
+#undef HAVE_ITERATOR_TRAITS
+
/* Define if log4shib library is used. */
#undef XMLTOOLING_LOG4SHIB
specialization. */
#define HAVE_GOOD_STL 1
+/* Define to 1 if you have an STL implementation that supports
+ std::iterator_traits. */
+#define HAVE_ITERATOR_TRAITS 1
+
/* Define if log4shib library is used. */
#define XMLTOOLING_LOG4SHIB 1
* @param compact true iff the encrypted representation should be made as small as possible
*/
EncryptionParams(
- const XMLCh* algorithm=DSIGConstants::s_unicodeStrURIAES256_CBC,
+ const XMLCh* algorithm=DSIGConstants::s_unicodeStrURIAES128_CBC,
const unsigned char* keyBuffer=NULL,
unsigned int keyBufferSize=0,
const xmltooling::Credential* credential=NULL,
CredentialCriteria::KEYINFO_EXTRACTION_KEYNAMES |
CredentialCriteria::KEYINFO_EXTRACTION_IMPLICIT_KEYNAMES;
if (m_criteria) {
- m_criteria->setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ m_criteria->setUsage(Credential::ENCRYPTION_CREDENTIAL);
m_criteria->setKeyInfo(encryptedData.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedData.getEncryptionMethod();
if (meth)
}
else {
CredentialCriteria criteria;
- criteria.setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ criteria.setUsage(Credential::ENCRYPTION_CREDENTIAL);
criteria.setKeyInfo(encryptedData.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedData.getEncryptionMethod();
if (meth)
CredentialCriteria::KEYINFO_EXTRACTION_KEYNAMES |
CredentialCriteria::KEYINFO_EXTRACTION_IMPLICIT_KEYNAMES;
if (m_criteria) {
- m_criteria->setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ m_criteria->setUsage(Credential::ENCRYPTION_CREDENTIAL);
m_criteria->setKeyInfo(encryptedData.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedData.getEncryptionMethod();
if (meth)
}
else {
CredentialCriteria criteria;
- criteria.setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ criteria.setUsage(Credential::ENCRYPTION_CREDENTIAL);
criteria.setKeyInfo(encryptedData.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedData.getEncryptionMethod();
if (meth)
CredentialCriteria::KEYINFO_EXTRACTION_IMPLICIT_KEYNAMES;
vector<const Credential*> creds;
if (m_criteria) {
- m_criteria->setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ m_criteria->setUsage(Credential::ENCRYPTION_CREDENTIAL);
m_criteria->setKeyInfo(encryptedKey.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedKey.getEncryptionMethod();
if (meth)
}
else {
CredentialCriteria criteria;
- criteria.setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ criteria.setUsage(Credential::ENCRYPTION_CREDENTIAL);
criteria.setKeyInfo(encryptedKey.getKeyInfo(), types);
const EncryptionMethod* meth = encryptedKey.getEncryptionMethod();
if (meth)
{
m_log.debug("marshalling text and child elements for XMLObject");
- const XMLCh* val;
unsigned int pos=0;
+ const XMLCh* val = getTextContent(pos);
+ if (val && *val)
+ domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
+
const list<XMLObject*>& children=getOrderedChildren();
for (list<XMLObject*>::const_iterator i=children.begin(); i!=children.end(); ++i) {
- val = getTextContent(pos);
- if (val && *val)
- domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
if (*i) {
#ifndef XMLTOOLING_NO_XMLSEC
(*i)->marshall(domElement,NULL,credential);
#else
(*i)->marshall(domElement);
#endif
- ++pos;
+ val = getTextContent(++pos);
+ if (val && *val)
+ domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
}
}
- val = getTextContent(pos);
- if (val && *val)
- domElement->appendChild(domElement->getOwnerDocument()->createTextNode(val));
}
--- /dev/null
+/*
+ * Copyright 2001-2007 Internet2
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * HTTPRequest.cpp
+ *
+ * Interface to HTTP requests
+ */
+
+#include "internal.h"
+#include "HTTPRequest.h"
+
+using namespace xmltooling;
+using namespace std;
+
+const char* HTTPRequest::getCookie(const char* name) const
+{
+ if (m_cookieMap.empty()) {
+ string cookies=getHeader("Cookie");
+
+ string::size_type pos=0,cname,namelen,val,vallen;
+ while (pos !=string::npos && pos < cookies.length()) {
+ while (isspace(cookies[pos])) pos++;
+ cname=pos;
+ pos=cookies.find_first_of("=",pos);
+ if (pos == string::npos)
+ break;
+ namelen=pos-cname;
+ pos++;
+ if (pos==cookies.length())
+ break;
+ val=pos;
+ pos=cookies.find_first_of(";",pos);
+ if (pos != string::npos) {
+ vallen=pos-val;
+ pos++;
+ m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val,vallen)));
+ }
+ else
+ m_cookieMap.insert(make_pair(cookies.substr(cname,namelen),cookies.substr(val)));
+ }
+ }
+ map<string,string>::const_iterator lookup=m_cookieMap.find(name);
+ return (lookup==m_cookieMap.end()) ? NULL : lookup->second.c_str();
+}
#include <xmltooling/io/GenericRequest.h>
+#include <map>
+
namespace xmltooling {
-
+
+#if defined (_MSC_VER)
+ #pragma warning( push )
+ #pragma warning( disable : 4251 )
+#endif
+
/**
* Interface to HTTP requests.
*
* @return the header's value, or an empty string
*/
virtual std::string getHeader(const char* name) const=0;
+
+ /**
+ * Get a cookie value supplied by the client.
+ *
+ * @param name name of cookie
+ * @return cookie value or NULL
+ */
+ virtual const char* getCookie(const char* name) const;
+
+ private:
+ mutable std::map<std::string,std::string> m_cookieMap;
};
+
+#if defined (_MSC_VER)
+ #pragma warning( pop )
+#endif
+
};
#endif /* __xmltooling_httpreq_h__ */
enum status_t {
XMLTOOLING_HTTP_STATUS_OK = 200,
XMLTOOLING_HTTP_STATUS_MOVED = 302,
+ XMLTOOLING_HTTP_STATUS_UNAUTHORIZED = 401,
XMLTOOLING_HTTP_STATUS_FORBIDDEN = 403,
XMLTOOLING_HTTP_STATUS_NOTFOUND = 404,
XMLTOOLING_HTTP_STATUS_ERROR = 500
public:
virtual ~BasicX509Credential();
+ unsigned int getUsage() const {
+ return UNSPECIFIED_CREDENTIAL;
+ }
const char* getAlgorithm() const;
unsigned int getKeySize() const;
};
/**
+ * Bitmask of use cases for credentials.
+ */
+ enum UsageTypes {
+ UNSPECIFIED_CREDENTIAL = 0,
+ SIGNING_CREDENTIAL = 1,
+ TLS_CREDENTIAL = 2,
+ ENCRYPTION_CREDENTIAL = 4
+ };
+
+ /**
+ * Get credential usage types.
+ *
+ * @return the usage bitmask
+ */
+ virtual unsigned int getUsage() const=0;
+
+ /**
* Returns an algorithm identifier for the Credential.
*
* @return the Credential algorithm, or NULL if indeterminate
{
MAKE_NONCOPYABLE(CredentialCriteria);
public:
- CredentialCriteria() : m_keyUsage(UNSPECIFIED_CREDENTIAL), m_keySize(0), m_key(NULL),
+ CredentialCriteria() : m_keyUsage(Credential::UNSPECIFIED_CREDENTIAL), m_keySize(0), m_key(NULL),
m_keyInfo(NULL), m_nativeKeyInfo(NULL), m_credential(NULL) {
}
virtual ~CredentialCriteria() {
* @return true iff the Credential is consistent with this criteria
*/
virtual bool matches(const Credential& credential) const;
-
- /**
- * Enumeration of use cases for credentials.
- */
- enum UsageType {
- UNSPECIFIED_CREDENTIAL,
- SIGNING_CREDENTIAL,
- TLS_CREDENTIAL,
- ENCRYPTION_CREDENTIAL
- };
-
+
/**
- * Get the key usage criteria.
+ * Get key usage criteria.
*
- * @return the usage.
+ * @return the usage mask
*/
- UsageType getUsage() const {
+ unsigned int getUsage() const {
return m_keyUsage;
}
/**
- * Set the key usage criteria.
+ * Set key usage criteria.
*
- * @param usage the usage to set
+ * @param usage the usage mask to set
*/
- void setUsage(UsageType usage) {
+ void setUsage(unsigned int usage) {
m_keyUsage = usage;
}
}
private:
- UsageType m_keyUsage;
+ unsigned int m_keyUsage;
unsigned int m_keySize;
std::string m_peerName,m_keyAlgorithm;
std::set<std::string> m_keyNames;
buf[len] = '\0';
subjectstr+=buf;
}
- log.debugStream() << "certificate subject: " << subjectstr << CategoryStream::ENDLINE;
+ log.debugStream() << "certificate subject: " << subjectstr << logging::eol;
// The flags give us LDAP order instead of X.500, with a comma plus space separator.
len=X509_NAME_print_ex(b2,subject,0,XN_FLAG_RFC2253 + XN_FLAG_SEP_CPLUS_SPC - XN_FLAG_SEP_COMMA_PLUS);
BIO_flush(b2);
if (criteria && criteria->getPeerName() && *(criteria->getPeerName())) {
log.debug("checking that the certificate name is acceptable");
- if (criteria->getUsage()==CredentialCriteria::UNSPECIFIED_CREDENTIAL)
- criteria->setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ if (criteria->getUsage()==Credential::UNSPECIFIED_CREDENTIAL)
+ criteria->setUsage(Credential::SIGNING_CREDENTIAL);
if (!checkEntityNames(certEE,credResolver,*criteria)) {
log.error("certificate name was not acceptable");
return false;
bool CredentialCriteria::matches(const Credential& credential) const
{
+ // Usage check, if specified and we have one, compare masks.
+ if (getUsage() != Credential::UNSPECIFIED_CREDENTIAL) {
+ if (credential.getUsage() != Credential::UNSPECIFIED_CREDENTIAL)
+ if ((getUsage() & credential.getUsage()) == 0)
+ return false;
+ }
+
// Algorithm check, if specified and we have one.
const char* alg = getKeyAlgorithm();
if (alg && *alg) {
}
// See if we have to match a specific key.
- XSECCryptoKey* key1 = getPublicKey();
+ const XSECCryptoKey* key1 = getPublicKey();
if (!key1)
return true; // no key to compare against, so we're done
- XSECCryptoKey* key2 = credential.getPublicKey();
+ const XSECCryptoKey* key2 = credential.getPublicKey();
if (!key2)
return true; // no key here, so we can't test it
if (key1->getKeyType()==XSECCryptoKey::KEY_RSA_PUBLIC || key1->getKeyType()==XSECCryptoKey::KEY_RSA_PAIR) {
if (key2->getKeyType()!=XSECCryptoKey::KEY_RSA_PUBLIC && key2->getKeyType()!=XSECCryptoKey::KEY_RSA_PAIR)
return false;
- RSA* rsa1 = static_cast<OpenSSLCryptoKeyRSA*>(key1)->getOpenSSLRSA();
- RSA* rsa2 = static_cast<OpenSSLCryptoKeyRSA*>(key2)->getOpenSSLRSA();
+ const RSA* rsa1 = static_cast<const OpenSSLCryptoKeyRSA*>(key1)->getOpenSSLRSA();
+ const RSA* rsa2 = static_cast<const OpenSSLCryptoKeyRSA*>(key2)->getOpenSSLRSA();
return (BN_cmp(rsa1->n,rsa2->n) == 0 && BN_cmp(rsa1->e,rsa2->e) == 0);
}
if (key1->getKeyType()==XSECCryptoKey::KEY_DSA_PUBLIC || key1->getKeyType()==XSECCryptoKey::KEY_DSA_PAIR) {
if (key2->getKeyType()!=XSECCryptoKey::KEY_DSA_PUBLIC && key2->getKeyType()!=XSECCryptoKey::KEY_DSA_PAIR)
return false;
- DSA* dsa1 = static_cast<OpenSSLCryptoKeyDSA*>(key1)->getOpenSSLDSA();
- DSA* dsa2 = static_cast<OpenSSLCryptoKeyDSA*>(key2)->getOpenSSLDSA();
+ const DSA* dsa1 = static_cast<const OpenSSLCryptoKeyDSA*>(key1)->getOpenSSLDSA();
+ const DSA* dsa2 = static_cast<const OpenSSLCryptoKeyDSA*>(key2)->getOpenSSLDSA();
return (BN_cmp(dsa1->pub_key,dsa2->pub_key) == 0);
}
vector<const Credential*> credentials;
if (criteria) {
- criteria->setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ criteria->setUsage(Credential::SIGNING_CREDENTIAL);
criteria->setSignature(sig, CredentialCriteria::KEYINFO_EXTRACTION_KEY);
credResolver.resolve(credentials,criteria);
}
else {
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ cc.setUsage(Credential::SIGNING_CREDENTIAL);
cc.setSignature(sig, CredentialCriteria::KEYINFO_EXTRACTION_KEY);
credResolver.resolve(credentials,&cc);
}
vector<const Credential*> credentials;
if (criteria) {
- criteria->setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ criteria->setUsage(Credential::SIGNING_CREDENTIAL);
criteria->setKeyInfo(keyInfo, CredentialCriteria::KEYINFO_EXTRACTION_KEY);
criteria->setXMLAlgorithm(sigAlgorithm);
credResolver.resolve(credentials,criteria);
}
else {
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ cc.setUsage(Credential::SIGNING_CREDENTIAL);
cc.setKeyInfo(keyInfo, CredentialCriteria::KEYINFO_EXTRACTION_KEY);
cc.setXMLAlgorithm(sigAlgorithm);
credResolver.resolve(credentials,&cc);
vector<const Credential*> credentials;
if (criteria) {
- if (criteria->getUsage()==CredentialCriteria::UNSPECIFIED_CREDENTIAL)
- criteria->setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ if (criteria->getUsage()==Credential::UNSPECIFIED_CREDENTIAL)
+ criteria->setUsage(Credential::SIGNING_CREDENTIAL);
credResolver.resolve(credentials,criteria);
}
else {
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ cc.setUsage(Credential::SIGNING_CREDENTIAL);
credResolver.resolve(credentials,&cc);
}
if (credentials.empty()) {
#include "security/CredentialResolver.h"
#include "security/KeyInfoResolver.h"
#include "security/OpenSSLCredential.h"
+#include "security/OpenSSLCryptoX509CRL.h"
#include "util/NDC.h"
#include "util/XMLHelper.h"
class XMLTOOL_DLLLOCAL FilesystemCredential : public OpenSSLCredential, public BasicX509Credential
{
public:
- FilesystemCredential(FilesystemCredentialResolver* resolver, XSECCryptoKey* key, const std::vector<XSECCryptoX509*>& xseccerts)
- : BasicX509Credential(key, xseccerts), m_resolver(resolver) {
+ FilesystemCredential(
+ FilesystemCredentialResolver* resolver, XSECCryptoKey* key, const std::vector<XSECCryptoX509*>& xseccerts, XSECCryptoX509CRL* crl=NULL
+ ) : BasicX509Credential(key, xseccerts, crl), m_resolver(resolver), m_usage(UNSPECIFIED_CREDENTIAL) {
if (!m_xseccerts.empty())
extractNames(m_xseccerts.front(), m_keyNames);
initKeyInfo();
virtual ~FilesystemCredential() {
}
+ unsigned int getUsage() const {
+ return m_usage;
+ }
+
+ void setUsage(const XMLCh* usage) {
+ if (usage && *usage) {
+ auto_ptr_char u(usage);
+ if (!strcmp(u.get(), "signing"))
+ m_usage = SIGNING_CREDENTIAL | TLS_CREDENTIAL;
+ else if (!strcmp(u.get(), "TLS"))
+ m_usage = TLS_CREDENTIAL;
+ else if (!strcmp(u.get(), "encryption"))
+ m_usage = ENCRYPTION_CREDENTIAL;
+ }
+ }
+
void addKeyNames(const DOMElement* e);
void attach(SSL_CTX* ctx) const;
private:
FilesystemCredentialResolver* m_resolver;
+ unsigned int m_usage;
};
#if defined (_MSC_VER)
private:
XSECCryptoKey* loadKey();
+ XSECCryptoX509CRL* loadCRL();
enum format_t { PEM=SSL_FILETYPE_PEM, DER=SSL_FILETYPE_ASN1, _PKCS12, UNKNOWN };
string formatToString(format_t format) const;
format_t xmlFormatToFormat(const XMLCh* format_xml) const;
- format_t m_keyformat;
- string m_keypath,m_keypass;
+ format_t m_keyformat,m_certformat,m_crlformat;
+ string m_keypath,m_keypass,m_certpath,m_certpass,m_crlpath;
vector<X509*> m_certs;
FilesystemCredential* m_credential;
};
static const XMLCh CAPath[] = UNICODE_LITERAL_6(C,A,P,a,t,h);
static const XMLCh Certificate[] = UNICODE_LITERAL_11(C,e,r,t,i,f,i,c,a,t,e);
static const XMLCh _certificate[] = UNICODE_LITERAL_11(c,e,r,t,i,f,i,c,a,t,e);
+ static const XMLCh CRL[] = UNICODE_LITERAL_3(C,R,L);
static const XMLCh format[] = UNICODE_LITERAL_6(f,o,r,m,a,t);
static const XMLCh Key[] = UNICODE_LITERAL_3(K,e,y);
static const XMLCh _key[] = UNICODE_LITERAL_3(k,e,y);
static const XMLCh Name[] = UNICODE_LITERAL_4(N,a,m,e);
static const XMLCh password[] = UNICODE_LITERAL_8(p,a,s,s,w,o,r,d);
static const XMLCh Path[] = UNICODE_LITERAL_4(P,a,t,h);
+ static const XMLCh _use[] = UNICODE_LITERAL_3(u,s,e);
};
FilesystemCredentialResolver::FilesystemCredentialResolver(const DOMElement* e) : m_credential(NULL)
}
const DOMElement* root=e;
+ const XMLCh* usage = root->getAttributeNS(NULL,_use);
XSECCryptoKey* key=NULL;
vector<XSECCryptoX509*> xseccerts;
+ XSECCryptoX509CRL* crl=NULL;
format_t fformat;
const XMLCh* format_xml=NULL;
// Move to Key
const DOMElement* keynode=XMLHelper::getFirstChildElement(root,Key);
if (keynode) {
-
// Get raw format attrib value, but defer processing til later since may need to
// determine format dynamically, and we need the Path for that.
format_xml=keynode->getAttributeNS(NULL,format);
// Load the key.
key = loadKey();
}
+
+ // Check for CRL.
+ const DOMElement* crlnode=XMLHelper::getFirstChildElement(root,CRL);
+ if (crlnode) {
+ // Get raw format attrib value, but defer processing til later since may need to
+ // determine format dynamically, and we need the Path for that.
+ format_xml=crlnode->getAttributeNS(NULL,format);
+
+ e=XMLHelper::getFirstChildElement(crlnode,Path);
+ if (e && e->hasChildNodes()) {
+ const XMLCh* s=e->getFirstChild()->getNodeValue();
+ auto_ptr_char kpath(s);
+#ifdef WIN32
+ struct _stat stat_buf;
+ if (_stat(kpath.get(), &stat_buf) != 0)
+#else
+ struct stat stat_buf;
+ if (stat(kpath.get(), &stat_buf) != 0)
+#endif
+ {
+ log.error("CRL file (%s) can't be opened", kpath.get());
+ throw XMLSecurityException("FilesystemCredentialResolver can't access CRL file ($1)",params(1,kpath.get()));
+ }
+ m_crlpath=kpath.get();
+ }
+ else {
+ log.error("Path element missing inside CRL element");
+ throw XMLSecurityException("FilesystemCredentialResolver can't access CRL file, no Path element specified.");
+ }
+
+ // Determine the CRL encoding format dynamically, if not explicitly specified
+ if (format_xml && *format_xml) {
+ fformat = xmlFormatToFormat(format_xml);
+ if (fformat != UNKNOWN) {
+ m_crlformat = fformat;
+ }
+ else {
+ auto_ptr_char unknown(format_xml);
+ log.error("configuration specifies unknown CRL encoding format (%s)", unknown.get());
+ throw XMLSecurityException("FilesystemCredentialResolver configuration contains unknown CRL encoding format ($1)",params(1,unknown.get()));
+ }
+ }
+ else {
+ in=BIO_new(BIO_s_file_internal());
+ if (in && BIO_read_filename(in,m_crlpath.c_str())>0) {
+ m_crlformat = getEncodingFormat(in);
+ log.debug("CRL encoding format for (%s) dynamically resolved as (%s)", m_crlpath.c_str(), formatToString(m_crlformat).c_str());
+ }
+ else {
+ log.error("CRL file (%s) can't be read to determine encoding format", m_crlpath.c_str());
+ throw XMLSecurityException("FilesystemCredentialResolver can't read CRL file ($1) to determine encoding format",params(1,m_crlpath.c_str()));
+ }
+ if (in)
+ BIO_free(in);
+ in = NULL;
+ }
+ // Load the key.
+ crl = loadCRL();
+ }
+
// Check for Certificate
e=XMLHelper::getFirstChildElement(root,Certificate);
if (!e) {
- m_credential = new FilesystemCredential(this,key,xseccerts);
+ m_credential = new FilesystemCredential(this,key,xseccerts,crl);
m_credential->addKeyNames(keynode);
+ m_credential->setUsage(usage);
return;
}
auto_ptr_char certpass(e->getAttributeNS(NULL,password));
if (!ep || !ep->hasChildNodes()) {
log.error("Path element missing inside Certificate element or is empty");
delete key;
+ delete crl;
throw XMLSecurityException("FilesystemCredentialResolver can't access certificate file, missing or empty Path element.");
}
auto_ptr_char unknown(format_xml);
log.error("configuration specifies unknown certificate encoding format (%s)", unknown.get());
delete key;
+ delete crl;
throw XMLSecurityException("FilesystemCredentialResolver configuration contains unknown certificate encoding format ($1)",params(1,unknown.get()));
}
}
}
catch (XMLToolingException&) {
delete key;
+ delete crl;
for_each(m_certs.begin(), m_certs.end(), X509_free);
throw;
}
xseccerts.push_back(new OpenSSLCryptoX509(*j));
if (!key && !xseccerts.empty())
key = xseccerts.front()->clonePublicKey();
- m_credential = new FilesystemCredential(this, key, xseccerts);
+ m_credential = new FilesystemCredential(this, key, xseccerts, crl);
m_credential->addKeyNames(keynode);
+ m_credential->setUsage(usage);
}
XSECCryptoKey* FilesystemCredentialResolver::loadKey()
throw XMLSecurityException("FilesystemCredentialResolver unable to load private key from file.");
}
+XSECCryptoX509CRL* FilesystemCredentialResolver::loadCRL()
+{
+#ifdef _DEBUG
+ NDC ndc("loadCRL");
+#endif
+
+ X509_CRL* crl=NULL;
+ BIO* in=BIO_new(BIO_s_file_internal());
+ if (in && BIO_read_filename(in,m_crlpath.c_str())>0) {
+ switch (m_crlformat) {
+ case PEM:
+ crl=PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
+ break;
+
+ case DER:
+ crl=d2i_X509_CRL_bio(in, NULL);
+ break;
+ }
+ }
+ if (in)
+ BIO_free(in);
+
+ // Now map it to an XSEC wrapper.
+ if (crl) {
+ XSECCryptoX509CRL* ret=new OpenSSLCryptoX509CRL(crl);
+ X509_CRL_free(crl);
+ return ret;
+ }
+
+ log_openssl();
+ throw XMLSecurityException("FilesystemCredentialResolver unable to load CRL from file.");
+}
+
// Used to determine the encoding format of credentials files
// dynamically. Supports: PEM, DER, PKCS12.
FilesystemCredentialResolver::format_t FilesystemCredentialResolver::getEncodingFormat(BIO* in) const
}
}
- // Check for RetrievalMethod.
- const XMLCh* fragID=NULL;
- const XMLObject* treeRoot=NULL;
- const vector<RetrievalMethod*>& methods=keyInfo->getRetrievalMethods();
- for (vector<RetrievalMethod*>::const_iterator m=methods.begin(); m!=methods.end(); ++m) {
- if (!XMLString::equals((*m)->getType(),RetrievalMethod::TYPE_RSAKEYVALUE) &&
- !XMLString::equals((*m)->getType(),RetrievalMethod::TYPE_DSAKEYVALUE))
- continue;
- fragID = (*m)->getURI();
- if (!fragID || *fragID != chPound || !*(fragID+1)) {
- log.warn("skipping ds:RetrievalMethod with an empty or non-local reference");
- continue;
- }
- if (!treeRoot) {
- treeRoot = keyInfo;
- while (treeRoot->getParent())
- treeRoot = treeRoot->getParent();
- }
- keyInfo = dynamic_cast<const KeyInfo*>(XMLHelper::getXMLObjectById(*treeRoot, fragID+1));
- if (!keyInfo) {
- log.warn("skipping ds:RetrievalMethod, local reference did not resolve to a ds:KeyInfo");
- continue;
- }
- if (resolveKey(keyInfo))
- return true;
- }
return false;
}
}
}
}
-
- if (m_xseccerts.empty()) {
- // Check for RetrievalMethod.
- const XMLCh* fragID=NULL;
- const XMLObject* treeRoot=NULL;
- const vector<RetrievalMethod*> methods=keyInfo->getRetrievalMethods();
- for (vector<RetrievalMethod*>::const_iterator m=methods.begin(); m!=methods.end(); ++m) {
- if (!XMLString::equals((*m)->getType(),RetrievalMethod::TYPE_X509DATA))
- continue;
- fragID = (*m)->getURI();
- if (!fragID || *fragID != chPound || !*(fragID+1)) {
- log.warn("skipping ds:RetrievalMethod with an empty or non-local reference");
- continue;
- }
- if (!treeRoot) {
- treeRoot = keyInfo;
- while (treeRoot->getParent())
- treeRoot = treeRoot->getParent();
- }
- keyInfo = dynamic_cast<const KeyInfo*>(XMLHelper::getXMLObjectById(*treeRoot, fragID+1));
- if (!keyInfo) {
- log.warn("skipping ds:RetrievalMethod, local reference did not resolve to a ds:KeyInfo");
- continue;
- }
- if (resolveCerts(keyInfo))
- return true;
- }
- return false;
- }
log.debug("resolved %d certificate(s)", m_xseccerts.size());
return !m_xseccerts.empty();
}
catch(XSECException& e) {
auto_ptr_char temp(e.getMsg());
- log.error("caught XML-Security exception loading certificate: %s", temp.get());
+ log.error("caught XML-Security exception loading CRL: %s", temp.get());
}
catch(XSECCryptoException& e) {
- log.error("caught XML-Security exception loading certificate: %s", e.getMsg());
+ log.error("caught XML-Security exception loading CRL: %s", e.getMsg());
}
}
}
- // Check for RetrievalMethod.
- const XMLCh* fragID=NULL;
- const XMLObject* treeRoot=NULL;
- const vector<RetrievalMethod*> methods=keyInfo->getRetrievalMethods();
- for (vector<RetrievalMethod*>::const_iterator m=methods.begin(); m!=methods.end(); ++m) {
- if (!XMLString::equals((*m)->getType(),RetrievalMethod::TYPE_X509DATA))
- continue;
- fragID = (*m)->getURI();
- if (!fragID || *fragID != chPound || !*(fragID+1)) {
- log.warn("skipping ds:RetrievalMethod with an empty or non-local reference");
- continue;
- }
- if (!treeRoot) {
- treeRoot = keyInfo;
- while (treeRoot->getParent())
- treeRoot = treeRoot->getParent();
- }
- keyInfo = dynamic_cast<const KeyInfo*>(XMLHelper::getXMLObjectById(*treeRoot, fragID+1));
- if (!keyInfo) {
- log.warn("skipping ds:RetrievalMethod, local reference did not resolve to a ds:KeyInfo");
- continue;
- }
- if (resolveCRL(keyInfo))
- return true;
- }
-
return false;
}
END_XMLOBJECT;
BEGIN_XMLOBJECT(XMLTOOL_API,Header,xmltooling::ElementProxy,SOAP 1.1 Header element);
- DECL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,false);
- DECL_STRING_ATTRIB(Actor,ACTOR);
+ /** Actor header block attribute name */
+ static const XMLCh ACTOR_ATTRIB_NAME[];
+ /** mustUnderstand header block attribute name */
+ static const XMLCh MUSTUNDERSTAND_ATTRIB_NAME[];
/** Header (type) local name */
static const XMLCh TYPE_NAME[];
END_XMLOBJECT;
END_XMLOBJECT;
DECL_SOAP11OBJECTBUILDER(Body);
- DECL_SOAP11OBJECTBUILDER(Detail);
DECL_SOAP11OBJECTBUILDER(Envelope);
DECL_SOAP11OBJECTBUILDER(Fault);
- DECL_SOAP11OBJECTBUILDER(Faultactor);
- DECL_SOAP11OBJECTBUILDER(Faultcode);
- DECL_SOAP11OBJECTBUILDER(Faultstring);
DECL_SOAP11OBJECTBUILDER(Header);
+ DECL_XMLOBJECTBUILDER(XMLTOOL_API,Detail,NULL,NULL);
+ DECL_XMLOBJECTBUILDER(XMLTOOL_API,Faultactor,NULL,NULL);
+ DECL_XMLOBJECTBUILDER(XMLTOOL_API,Faultcode,NULL,NULL);
+ DECL_XMLOBJECTBUILDER(XMLTOOL_API,Faultstring,NULL,NULL);
/**
* Registers builders and validators for SOAP 1.1 classes into the runtime.
CURLoption opt = static_cast<CURLoption>(strtol(option, NULL, 10));
if (opt < CURLOPTTYPE_OBJECTPOINT)
return (curl_easy_setopt(m_handle, opt, strtol(value, NULL, 10)) == CURLE_OK);
+#ifdef CURLOPTTYPE_OFF_T
else if (opt < CURLOPTTYPE_OFF_T)
return (curl_easy_setopt(m_handle, opt, value) == CURLE_OK);
else if (sizeof(curl_off_t) == sizeof(long))
return (curl_easy_setopt(m_handle, opt, strtol(value, NULL, 10)) == CURLE_OK);
return false;
+#else
+ else
+ return (curl_easy_setopt(m_handle, opt, value) == CURLE_OK);
+#endif
}
void send(istream& in);
bool success=false;
if (ctx->m_criteria) {
- ctx->m_criteria->setUsage(CredentialCriteria::TLS_CREDENTIAL);
+ ctx->m_criteria->setUsage(Credential::TLS_CREDENTIAL);
// Bypass name check (handled for us by curl).
ctx->m_criteria->setPeerName(NULL);
success = ctx->m_trustEngine->validate(x509_ctx->cert,x509_ctx->untrusted,*(ctx->m_peerResolver),ctx->m_criteria);
else {
// Bypass name check (handled for us by curl).
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::TLS_CREDENTIAL);
+ cc.setUsage(Credential::TLS_CREDENTIAL);
success = ctx->m_trustEngine->validate(x509_ctx->cert,x509_ctx->untrusted,*(ctx->m_peerResolver),&cc);
}
m_transport = XMLToolingConfig::getConfig().SOAPTransportManager.newPlugin(scheme.c_str(), addr);
prepareTransport(*m_transport);
+ Category& log = Category::getInstance(XMLTOOLING_LOGCAT".SOAPClient");
+ if (log.isDebugEnabled())
+ log.debugStream() << "marshalled envelope:" << logging::eol << env << logging::eol;
+
// Serialize envelope.
stringstream s;
s << env;
DOMDocument* doc = (m_validate ? XMLToolingConfig::getConfig().getValidatingParser()
: XMLToolingConfig::getConfig().getParser()).parse(out);
XercesJanitor<DOMDocument> janitor(doc);
+
+ Category& log = Category::getInstance(XMLTOOLING_LOGCAT".SOAPClient");
+ if (log.isDebugEnabled())
+ log.debugStream() << "received XML:" << logging::eol << *(doc->getDocumentElement()) << logging::eol;
+
auto_ptr<XMLObject> xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true));
janitor.release();
if (!m_validate)
protected:
void processChildElement(XMLObject* childXMLObject, const DOMElement* root) {
- PROC_TYPED_CHILD(Faultcode,SOAP11ENV_NS,false);
- PROC_TYPED_CHILD(Faultstring,SOAP11ENV_NS,false);
- PROC_TYPED_CHILD(Faultactor,SOAP11ENV_NS,false);
- PROC_TYPED_CHILD(Detail,SOAP11ENV_NS,false);
+ PROC_TYPED_CHILD(Faultcode,NULL,false);
+ PROC_TYPED_CHILD(Faultstring,NULL,false);
+ PROC_TYPED_CHILD(Faultactor,NULL,false);
+ PROC_TYPED_CHILD(Detail,NULL,false);
AbstractXMLObjectUnmarshaller::processChildElement(childXMLObject,root);
}
};
IMPL_STRING_ATTRIB(EncodingStyle);
IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
+ using AbstractAttributeExtensibleXMLObject::setAttribute;
void setAttribute(QName& qualifiedName, const XMLCh* value, bool ID=false) {
if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),SOAP11ENV_NS)) {
if (XMLString::equals(qualifiedName.getLocalPart(),ENCODINGSTYLE_ATTRIB_NAME)) {
public AbstractXMLObjectMarshaller,
public AbstractXMLObjectUnmarshaller
{
- void init() {
- m_Actor=NULL;
- m_MustUnderstand=xmlconstants::XML_BOOL_NULL;
- }
public:
virtual ~HeaderImpl() {
- XMLString::release(&m_Actor);
}
HeaderImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const QName* schemaType)
: AbstractXMLObject(nsURI, localName, prefix, schemaType) {
- init();
}
HeaderImpl(const HeaderImpl& src)
AbstractAttributeExtensibleXMLObject(src),
AbstractComplexElement(src),
AbstractDOMCachingXMLObject(src) {
- init();
- setActor(src.getActor());
- MustUnderstand(m_MustUnderstand);
VectorOf(XMLObject) v=getUnknownXMLObjects();
for (vector<XMLObject*>::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i)
v.push_back((*i)->clone());
}
IMPL_XMLOBJECT_CLONE(Header);
- IMPL_STRING_ATTRIB(Actor);
- IMPL_BOOLEAN_ATTRIB(MustUnderstand);
IMPL_XMLOBJECT_CHILDREN(UnknownXMLObject, m_children.end());
- void setAttribute(QName& qualifiedName, const XMLCh* value, bool ID=false) {
- if (qualifiedName.hasNamespaceURI() && XMLString::equals(qualifiedName.getNamespaceURI(),SOAP11ENV_NS)) {
- if (XMLString::equals(qualifiedName.getLocalPart(),MUSTUNDERSTAND_ATTRIB_NAME)) {
- setMustUnderstand(value);
- return;
- }
- else if (XMLString::equals(qualifiedName.getLocalPart(),ACTOR_ATTRIB_NAME)) {
- setActor(value);
- return;
- }
- }
- AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value, ID);
- }
-
protected:
void marshallAttributes(DOMElement* domElement) const {
- MARSHALL_STRING_ATTRIB(Actor,ACTOR,SOAP11ENV_NS);
- MARSHALL_BOOLEAN_ATTRIB(MustUnderstand,MUSTUNDERSTAND,SOAP11ENV_NS);
marshallExtensionAttributes(domElement);
}
{
QName q;
REGISTER_ELEMENT_NOVAL(SOAP11ENV_NS,Body);
- REGISTER_ELEMENT_NOVAL(SOAP11ENV_NS,Detail);
+ REGISTER_ELEMENT_NOVAL(NULL,Detail);
REGISTER_ELEMENT(SOAP11ENV_NS,Envelope);
REGISTER_ELEMENT(SOAP11ENV_NS,Fault);
- REGISTER_ELEMENT(SOAP11ENV_NS,Faultactor);
- REGISTER_ELEMENT(SOAP11ENV_NS,Faultcode);
- REGISTER_ELEMENT(SOAP11ENV_NS,Faultstring);
+ REGISTER_ELEMENT(NULL,Faultactor);
+ REGISTER_ELEMENT(NULL,Faultcode);
+ REGISTER_ELEMENT(NULL,Faultstring);
REGISTER_ELEMENT_NOVAL(SOAP11ENV_NS,Header);
REGISTER_TYPE_NOVAL(SOAP11ENV_NS,Body);
REGISTER_TYPE_NOVAL(SOAP11ENV_NS,Detail);
using namespace xmltooling;
-const XMLCh CurlNetAccessor::fgMyName[] =
+const XMLCh xmltooling::CurlNetAccessor::fgMyName[] =
{
chLatin_C, chLatin_u, chLatin_r, chLatin_l, chLatin_N, chLatin_e,
chLatin_t, chLatin_A, chLatin_c, chLatin_c, chLatin_e, chLatin_s,
* $Id$
*/
-#if !defined(XERCESC_INCLUDE_GUARD_CURLNETACCESSOR_HPP)
+#if !defined(XERCESC_INCLUDE_GUARD_CURLNETACCESSOR_HPP) && !defined(XMLTOOLING_LITE)
#define XERCESC_INCLUDE_GUARD_CURLNETACCESSOR_HPP
#include <xmltooling/base.h>
// a HTTP or FTP URL.
//
-class XMLTOOL_EXPORT CurlNetAccessor : public XMLNetAccessor
+class XMLTOOL_API CurlNetAccessor : public XMLNetAccessor
{
public :
CurlNetAccessor();
curl_easy_setopt(fEasy, CURLOPT_URL, fURL.get());
curl_easy_setopt(fEasy, CURLOPT_WRITEDATA, this); // Pass this pointer to write function
curl_easy_setopt(fEasy, CURLOPT_WRITEFUNCTION, staticWriteCallback); // Our static write function
+ curl_easy_setopt(fEasy, CURLOPT_CONNECTTIMEOUT, 15);
+ curl_easy_setopt(fEasy, CURLOPT_TIMEOUT, 30);
+ curl_easy_setopt(fEasy, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+ curl_easy_setopt(fEasy, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(fEasy, CURLOPT_SSL_VERIFYPEER, 0);
+ curl_easy_setopt(fEasy, CURLOPT_NOPROGRESS, 1);
+ curl_easy_setopt(fEasy, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(fEasy, CURLOPT_FAILONERROR, 1);
// Add easy handle to the multi stack
curl_multi_add_handle(fMulti, fEasy);
// read any yet on this invocation, call select to wait for data
if (!tryAgain && fBytesRead == 0)
{
- fd_set readSet[16];
- fd_set writeSet[16];
- fd_set exceptSet[16];
- int fdcnt = 16;
+ fd_set readSet;
+ fd_set writeSet;
+ fd_set exceptSet;
+ int fdcnt=0;
- // As curl for the file descriptors to wait on
- (void) curl_multi_fdset(fMulti, readSet, writeSet, exceptSet, &fdcnt);
+ // Ask curl for the file descriptors to wait on
+ FD_ZERO(&readSet);
+ FD_ZERO(&writeSet);
+ FD_ZERO(&exceptSet);
+ (void) curl_multi_fdset(fMulti, &readSet, &writeSet, &exceptSet, &fdcnt);
// Wait on the file descriptors
timeval tv;
tv.tv_sec = 2;
tv.tv_usec = 0;
- (void) select(fdcnt, readSet, writeSet, exceptSet, &tv);
+ (void) select(fdcnt, &readSet, &writeSet, &exceptSet, &tv);
}
}
* $Id$
*/
-#if !defined(XERCESC_INCLUDE_GUARD_CURLURLINPUTSTREAM_HPP)
+#if !defined(XERCESC_INCLUDE_GUARD_CURLURLINPUTSTREAM_HPP) && !defined(XMLTOOLING_LITE)
#define XERCESC_INCLUDE_GUARD_CURLURLINPUTSTREAM_HPP
#include <xmltooling/base.h>
// parser.
//
-class XMLTOOL_EXPORT CurlURLInputStream : public BinInputStream
+class XMLTOOL_API CurlURLInputStream : public BinInputStream
{
public :
CurlURLInputStream(const XMLURL& urlSource, const XMLNetHTTPInfo* httpInfo=0);
#include <ctime>
#include <assert.h>
#include <xercesc/util/Janitor.hpp>
-#include <xercesc/util/NumberFormatException.hpp>
using namespace xmltooling;
using namespace std;
//fStart is supposed to point to 'T'
if (fBuffer[fStart++] != DATETIME_SEPARATOR)
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gDay_invalid
- , fBuffer);
+ throw XMLParserException("Invalid separator between date and time.");
getTime();
validateDateTime();
fBuffer[1] != DATE_SEPARATOR ||
fBuffer[2] != DATE_SEPARATOR )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gDay_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
//initialize values
int sign = findUTCSign(DAY_SIZE);
if ( sign < 0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gDay_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
else
{
if (fBuffer[0] != DATE_SEPARATOR ||
fBuffer[1] != DATE_SEPARATOR )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gMth_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
//set constants
int sign = findUTCSign(fStart);
if ( sign < 0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gMth_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
else
{
fBuffer[1] != DATE_SEPARATOR ||
fBuffer[4] != DATE_SEPARATOR )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gMthDay_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
int sign = findUTCSign(MONTHDAY_SIZE);
if ( sign<0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_gMthDay_invalid
- , fBuffer);
+ throw XMLParserException("Invalid character in date.");
}
else
{
if ( (c != DURATION_STARTER) &&
(c != chDash) )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_Start_dashP
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
// 'P' must ALWAYS be present in either case
if ( (c == chDash) &&
(fBuffer[fStart++]!= DURATION_STARTER ))
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_noP
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
// java code
//
if (indexOf(fStart, fEnd, chDash) != NOT_FOUND)
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_DashNotFirst
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
//at least one number and designator must be seen after P
if ( (fEnd == endDate) && // 'T' absent
(fStart != fEnd) ) // something after Day
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_inv_b4T
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
if ( fEnd != endDate ) // 'T' present
*/
if ( mlsec+1 == end )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_inv_seconds
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
fValue[Second] = negate * parseInt(fStart, mlsec);
if ( (fStart != fEnd) ||
fBuffer[--fStart] == DATETIME_SEPARATOR )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_NoTimeAfterT
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
}
if ( !designator )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_dur_NoElementAtAll
- , fBuffer);
+ throw XMLParserException("Invalid character in time.");
}
}
// Ensure enough chars in buffer
if ( (fStart+YMD_MIN_SIZE) > fEnd)
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_date_incomplete
- , fBuffer);
+ throw XMLParserException("Date/time string not complete.");
getYearMonth(); // Scan YearMonth and
// fStart point to the next '-'
if (fBuffer[fStart++] != DATE_SEPARATOR)
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_date_invalid
- , fBuffer);
- //("CCYY-MM must be followed by '-' sign");
+ throw XMLParserException("CCYY-MM must be followed by '-' sign.");
}
fValue[Day] = parseInt(fStart, fStart+2);
// Ensure enough chars in buffer
if ( (fStart+TIME_MIN_SIZE) > fEnd)
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_time_incomplete
- , fBuffer);
- //"Imcomplete Time Format"
+ throw XMLParserException("Incomplete Time Format.");
// check (fixed) format first
if ((fBuffer[fStart + 2] != TIME_SEPARATOR) ||
(fBuffer[fStart + 5] != TIME_SEPARATOR) )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_time_invalid
- , fBuffer);
- //("Error in parsing time" );
+ throw XMLParserException("Error in parsing time.");
}
//
// make sure we have some thing between the '.' and fEnd
if (fStart >= fEnd)
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_ms_noDigit
- , fBuffer);
- //("ms shall be present once '.' is present" );
+ throw XMLParserException("ms should be present once '.' is present.");
}
if ( sign == NOT_FOUND )
}
else if(sign == 0 || sign != fStart)
{
- // seconds has more than 2 digits
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_min_invalid
- , fBuffer);
+ throw XMLParserException("Seconds has more than 2 digits.");
}
//parse UTC time zone (hh:mm)
// Ensure enough chars in buffer
if ( (fStart+YMONTH_MIN_SIZE) > fEnd)
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_ym_incomplete
- , fBuffer);
- //"Imcomplete YearMonth Format";
+ throw XMLParserException("Incomplete YearMonth Format.");
// skip the first leading '-'
int start = ( fBuffer[0] == chDash ) ? fStart + 1 : fStart;
//
int yearSeparator = indexOf(start, fEnd, DATE_SEPARATOR);
if ( yearSeparator == NOT_FOUND)
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_ym_invalid
- , fBuffer);
- //("Year separator is missing or misplaced");
+ throw XMLParserException("Year separator is missing or misplaced.");
fValue[CentYear] = parseIntYear(yearSeparator);
fStart = yearSeparator + 1; //skip the '-' and point to the first M
//gonna check we have enough byte for month
//
if ((fStart + 2) > fEnd )
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_ym_noMonth
- , fBuffer);
- //"no month in buffer"
+ throw XMLParserException("No month in buffer.");
fValue[Month] = parseInt(fStart, yearSeparator + 3);
fStart += 2; //fStart points right after the MONTH
int sign = findUTCSign(fStart);
if ( sign < 0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_tz_noUTCsign
- , fBuffer);
- //("Error in month parsing");
+ throw XMLParserException("Error in month parsing.");
}
else
{
{
if ((sign + 1) != fEnd )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_tz_stuffAfterZ
- , fBuffer);
- //"Error in parsing time zone");
+ throw XMLParserException("Error in parsing time zone.");
}
return;
if ( ( ( sign + TIMEZONE_SIZE + 1) != fEnd ) ||
( fBuffer[sign + 3] != TIMEZONE_SEPARATOR ) )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_tz_invalid
- , fBuffer);
- //("Error in parsing time zone");
+ throw XMLParserException("Error in parsing time zone.");
}
fTimeZone[hh] = parseInt(sign+1, sign+3);
// or reporting an error message should be sufficient?
if ( fValue[CentYear] == 0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_year_zero
- , fBuffer);
- //"The year \"0000\" is an illegal year value");
+ throw XMLParserException("The year \"0000\" is an illegal year value");
}
if ( fValue[Month] < 1 ||
fValue[Month] > 12 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_mth_invalid
- , fBuffer);
- //"The month must have values 1 to 12");
+ throw XMLParserException("The month must have values 1 to 12");
}
//validate days
if ( fValue[Day] > maxDayInMonthFor( fValue[CentYear], fValue[Month]) ||
fValue[Day] == 0 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_day_invalid
- , fBuffer);
- //"The day must have values 1 to 31");
+ throw XMLParserException("The day must have values 1 to 31");
}
//validate hours
(fValue[Second] !=0) ||
(fMiliSecond !=0))))
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_hour_invalid
- , fBuffer);
- //("Hour must have values 0-23");
+ throw XMLParserException("Hour must have values 0-23");
}
//validate minutes
if ( fValue[Minute] < 0 ||
fValue[Minute] > 59 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_min_invalid
- , fBuffer);
- //"Minute must have values 0-59");
+ throw XMLParserException("Minute must have values 0-59");
}
//validate seconds
if ( fValue[Second] < 0 ||
fValue[Second] > 60 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_second_invalid
- , fBuffer);
- //"Second must have values 0-60");
+ throw XMLParserException("Second must have values 0-60");
}
//validate time-zone hours
if ( (abs(fTimeZone[hh]) > 14) ||
((abs(fTimeZone[hh]) == 14) && (fTimeZone[mm] != 0)) )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_tz_hh_invalid
- , fBuffer);
- //"Time zone should have range -14..+14");
+ throw XMLParserException("Time zone should have range -14..+14");
}
//validate time-zone minutes
if ( abs(fTimeZone[mm]) > 59 )
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_min_invalid
- , fBuffer);
- //("Minute must have values 0-59");
+ throw XMLParserException("Minute must have values 0-59");
}
return;
for (int i=start; i < end; i++) {
if (fBuffer[i] < chDigit_0 || fBuffer[i] > chDigit_9)
- ThrowXML(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars);
+ throw XMLParserException("Invalid non-numeric characters.");
retVal = (retVal * 10) + (unsigned int) (fBuffer[i] - chDigit_0);
}
// check if all chars are valid char
if ( (endptr - nptr) != strLen)
- ThrowXML(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars);
+ throw XMLParserException("Invalid non-numeric characters.");
// we don't check underflow occurs since
// nothing we can do about it.
int length = end - start;
if (length < 4)
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_year_tooShort
- , fBuffer);
- //"Year must have 'CCYY' format");
+ throw XMLParserException("Year must have 'CCYY' format");
}
else if (length > 4 &&
fBuffer[start] == chDigit_0)
{
- ThrowXML1(SchemaDateTimeException
- , XMLExcepts::DateTime_year_leadingZero
- , fBuffer);
- //"Leading zeros are required if the year value would otherwise have fewer than four digits;
- // otherwise they are forbidden");
+ throw XMLParserException("Leading zeros are required if the year value would otherwise have fewer than four digits; otherwise they are forbidden.");
}
bool negative = (fBuffer[0] == chDash);
using namespace std;
ParserPool::ParserPool(bool namespaceAware, bool schemaAware)
- : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()) {}
+ : m_namespaceAware(namespaceAware), m_schemaAware(schemaAware), m_lock(Mutex::create()), m_security(new SecurityManager()) {}
ParserPool::~ParserPool()
{
m_pool.pop();
}
delete m_lock;
+ delete m_security;
}
DOMDocument* ParserPool::newDocument()
case DOMError::DOM_SEVERITY_WARNING:
log.warnStream() << "warning on line " << locator->getLineNumber()
<< ", column " << locator->getColumnNumber()
- << ", message: " << temp.get() << CategoryStream::ENDLINE;
+ << ", message: " << temp.get() << logging::eol;
return true;
case DOMError::DOM_SEVERITY_ERROR:
log.errorStream() << "error on line " << locator->getLineNumber()
<< ", column " << locator->getColumnNumber()
- << ", message: " << temp.get() << CategoryStream::ENDLINE;
+ << ", message: " << temp.get() << logging::eol;
throw XMLParserException(string("error during XML parsing: ") + (temp.get() ? temp.get() : "no message"));
case DOMError::DOM_SEVERITY_FATAL_ERROR:
- log.critStream() << "fatal error on line " << locator->getLineNumber()
+ log.errorStream() << "fatal error on line " << locator->getLineNumber()
<< ", column " << locator->getColumnNumber()
- << ", message: " << temp.get() << CategoryStream::ENDLINE;
+ << ", message: " << temp.get() << logging::eol;
throw XMLParserException(string("fatal error during XML parsing: ") + (temp.get() ? temp.get() : "no message"));
}
throw XMLParserException(string("unclassified error during XML parsing: ") + (temp.get() ? temp.get() : "no message"));
parser->setProperty(XMLUni::fgXercesSchemaExternalSchemaLocation,const_cast<XMLCh*>(temp.get()));
#endif
}
+ parser->setProperty(XMLUni::fgXercesSecurityManager, m_security);
parser->setFeature(XMLUni::fgXercesUserAdoptsDOMDocument,true);
parser->setEntityResolver(this);
parser->setErrorHandler(this);
catch(ios_base::failure& e) {
Category::getInstance(XMLTOOLING_LOGCAT".StreamInputSource").critStream()
<< "XML::StreamInputSource::StreamBinInputStream::readBytes caught an exception: " << e.what()
- << CategoryStream::ENDLINE;
+ << logging::eol;
*toFill=0;
return 0;
}
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/util/BinInputStream.hpp>
+#include <xercesc/util/SecurityManager.hpp>
#if defined (_MSC_VER)
#pragma warning( push )
bool m_namespaceAware,m_schemaAware;
std::stack<xercesc::DOMBuilder*> m_pool;
Mutex* m_lock;
+ xercesc::SecurityManager* m_security;
};
/**
--- /dev/null
+/*
+ * Copyright 2001-2007 Internet2
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file xmltooling/util/Predicates.h
+ *
+ * Useful XMLObject predicates for use with STL algorithms.
+ */
+
+#ifndef __xmltooling_predicates_h__
+#define __xmltooling_predicates_h__
+
+#include <xmltooling/XMLObject.h>
+
+#include <functional>
+
+namespace xmltooling {
+
+ /**
+ * Predicate that checks the QName of an XMLObject.
+ */
+ class hasQName
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param q the QName to check for
+ */
+ hasQName(const QName& q) : m_q(q) {
+ }
+
+ /**
+ * Returns true iff the provided object's QName matches the constructor argument.
+ *
+ * @param xmlObject the object to examine
+ */
+ bool operator()(const XMLObject* xmlObject) const {
+ return xmlObject ? (xmlObject->getElementQName() == m_q) : false;
+ }
+
+ private:
+ const QName& m_q;
+ };
+
+ /**
+ * Predicate that checks the xsi:type of an XMLObject.
+ */
+ class hasSchemaType
+ {
+ public:
+ /**
+ * Constructor.
+ *
+ * @param q the QName to check for
+ */
+ hasSchemaType(const QName& q) : m_q(q) {
+ }
+
+ /**
+ * Returns true iff the provided object's xsi:type matches the constructor argument.
+ *
+ * @param xmlObject the object to examine
+ */
+ bool operator()(const XMLObject* xmlObject) const {
+ const QName* xsitype = xmlObject ? xmlObject->getSchemaType() : NULL;
+ return xsitype ? (*xsitype == m_q) : false;
+ }
+
+ private:
+ const QName& m_q;
+ };
+
+ /**
+ * Template algorithm returns first pointer element from a container that matches a predicate.
+ *
+ * @param c read-only container of pointer-based objects
+ * @param p a predicate function
+ * @return the first object in the container matching the predicate, or NULL
+ */
+ template<typename Container, typename Predicate>
+ typename Container::value_type find_if(const Container& c, const Predicate& p) {
+ typename Container::const_iterator i = std::find_if(c.begin(), c.end(), p);
+ return (i!=c.end()) ? *i : NULL;
+ }
+
+ /**
+ * Template algorithm returns first pointer element from a container that matches a predicate.
+ *
+ * @param c read-only container of pointer-based objects
+ * @param p a predicate function
+ * @return the first object in the container matching the predicate, or NULL
+ */
+ template<typename Container, typename Predicate>
+ typename Container::value_type find_if(Container& c, const Predicate& p) {
+ typename Container::iterator i = std::find_if(c.begin(), c.end(), p);
+ return (i!=c.end()) ? *i : NULL;
+ }
+
+};
+
+#endif /* __xmltooling_predicates_h__ */
doc=XMLToolingConfig::getConfig().getParser().parse(dsrc);\r
}\r
\r
- m_log.infoStream() << "loaded XML resource (" << (backup ? m_backing : m_source) << ")" << CategoryStream::ENDLINE;\r
+ m_log.infoStream() << "loaded XML resource (" << (backup ? m_backing : m_source) << ")" << logging::eol;\r
\r
if (!backup && !m_backing.empty()) {\r
m_log.debug("backing up remote resource to (%s)", m_backing.c_str());\r
}\r
catch (XMLException& e) {\r
auto_ptr_char msg(e.getMessage());\r
- m_log.critStream() << "Xerces error while loading resource (" << (backup ? m_backing : m_source) << "): "\r
- << msg.get() << CategoryStream::ENDLINE;\r
+ m_log.errorStream() << "Xerces error while loading resource (" << (backup ? m_backing : m_source) << "): "\r
+ << msg.get() << logging::eol;\r
if (!backup && !m_backing.empty())\r
return load(true);\r
throw XMLParserException(msg.get());\r
}\r
catch (exception& e) {\r
- m_log.critStream() << "error while loading configuration from ("\r
- << (m_source.empty() ? "inline" : (backup ? m_backing : m_source)) << "): " << e.what() << CategoryStream::ENDLINE;\r
+ m_log.errorStream() << "error while loading configuration from ("\r
+ << (m_source.empty() ? "inline" : (backup ? m_backing : m_source)) << "): " << e.what() << logging::eol;\r
if (!backup && !m_backing.empty())\r
return load(true);\r
throw;\r
#ifndef __xmltooling_template_h__
#define __xmltooling_template_h__
-#include <xmltooling/base.h>
+#include <xmltooling/io/GenericRequest.h>
#include <map>
#include <string>
class XMLTOOL_API TemplateParameters {
MAKE_NONCOPYABLE(TemplateParameters);
public:
- TemplateParameters() {}
+ TemplateParameters() : m_request(NULL) {}
virtual ~TemplateParameters() {}
/** Map of known parameters to supply to template. */
std::map<std::string,std::string> m_map;
+ /** Request from client that resulted in template being processed. */
+ const GenericRequest* m_request;
+
/**
* Returns the value of a parameter to plug into the template.
*
*/
virtual const char* getParameter(const char* name) const {
std::map<std::string,std::string>::const_iterator i=m_map.find(name);
- return (i!=m_map.end() ? i->second.c_str() : NULL);
+ return (i!=m_map.end() ? i->second.c_str() : (m_request ? m_request->getParameter(name) : NULL));
}
};
/**
* STL iterator that mediates access to an iterator over typed XML children.
- * @param _Ty a bidrectional sequence of the subtype to iterate over
+ *
+ * @param Container type of container
+ * @param _Ty a bidrectional iterator to guard
*/
- template <class _Ty>
+ template <class Container, typename _Ty>
class XMLObjectChildrenIterator
{
/// @cond OFF
- typename _Ty::iterator m_iter;
+ _Ty m_iter;
template <class _Tx, class _Tz> friend class XMLObjectChildrenList;
template <class _Tx, class _Tz> friend class XMLObjectPairList;
public:
+#ifdef HAVE_ITERATOR_TRAITS
+ typedef typename std::iterator_traits<_Ty>::iterator_category iterator_category;
+ typedef typename std::iterator_traits<_Ty>::value_type value_type;
+ typedef typename std::iterator_traits<_Ty>::difference_type difference_type;
+ typedef typename std::iterator_traits<_Ty>::pointer pointer;
+ typedef typename std::iterator_traits<_Ty>::reference reference;
+#else
+ typedef typename _Ty::iterator_category iterator_category;
typedef typename _Ty::value_type value_type;
- typedef typename _Ty::reference reference;
- typedef typename _Ty::pointer pointer;
- typedef typename _Ty::const_reference const_reference;
- typedef typename _Ty::const_pointer const_pointer;
typedef typename _Ty::difference_type difference_type;
+ typedef typename _Ty::pointer pointer;
+ typedef typename _Ty::reference reference;
+#endif
+ typedef typename Container::const_reference const_reference;
+ typedef typename Container::const_pointer const_pointer;
+
+ XMLObjectChildrenIterator() {
+ }
+
+ XMLObjectChildrenIterator(_Ty iter) {
+ m_iter=iter;
+ }
+
+ const_reference operator*() const {
+ return *m_iter;
+ }
+
+ const_reference operator->() const {
+ return *m_iter;
+ }
+
+ XMLObjectChildrenIterator& operator++() {
+ // preincrement
+ ++m_iter;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator& operator--() {
+ // predecrement
+ --m_iter;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator operator++(int) {
+ // postincrement
+ XMLObjectChildrenIterator _Tmp = *this;
+ ++*this;
+ return (_Tmp);
+ }
+
+ XMLObjectChildrenIterator operator--(int) {
+ // postdecrement
+ XMLObjectChildrenIterator _Tmp = *this;
+ --*this;
+ return (_Tmp);
+ }
+
+ XMLObjectChildrenIterator& operator+=(difference_type _Off) {
+ // increment by integer
+ m_iter += _Off;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator operator+(difference_type _Off) const {
+ // return this + integer
+ return m_iter + _Off;
+ }
+
+ XMLObjectChildrenIterator& operator-=(difference_type _Off) {
+ // decrement by integer
+ return (*this += -_Off);
+ }
+
+ XMLObjectChildrenIterator operator-(difference_type _Off) const {
+ // return this - integer
+ XMLObjectChildrenIterator _Tmp = *this;
+ return (_Tmp -= _Off);
+ }
+
+ difference_type operator-(const XMLObjectChildrenIterator& _Right) const {
+ // return difference of iterators
+ return m_iter - _Right.m_iter;
+ }
+
+ const_reference operator[](difference_type _Off) const {
+ // subscript
+ return (*(*this + _Off));
+ }
+
+ bool operator==(const XMLObjectChildrenIterator &_Right) const {
+ // test for iterator equality
+ return (m_iter == _Right.m_iter);
+ }
+
+ bool operator!=(const XMLObjectChildrenIterator &_Right) const {
+ // test for iterator inequality
+ return (!(m_iter == _Right.m_iter));
+ }
+
+ bool operator<(const XMLObjectChildrenIterator &_Right) const {
+ return (m_iter < _Right.m_iter);
+ }
+ /// @endcond
+ };
+
+#ifndef HAVE_ITERATOR_TRAITS
+ /**
+ * STL iterator that mediates access to an iterator that's a pointer.
+ *
+ * @param Container type of container
+ * @param _Ty the type of object being referenced
+ */
+ template <class Container, typename _Ty>
+ class XMLObjectChildrenIterator<Container, _Ty*>
+ {
+ /// @cond OFF
+ typename _Ty* m_iter;
+ template <class _Tx, class _Tz> friend class XMLObjectChildrenList;
+ template <class _Tx, class _Tz> friend class XMLObjectPairList;
+ public:
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef _Ty value_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Ty* pointer;
+ typedef _Ty& reference;
+ typedef const _Ty& const_reference;
+ typedef const _Ty* const_pointer;
XMLObjectChildrenIterator() {
}
- XMLObjectChildrenIterator(typename _Ty::iterator iter) {
+ XMLObjectChildrenIterator(_Ty* iter) {
m_iter=iter;
}
// test for iterator inequality
return (!(m_iter == _Right.m_iter));
}
+
+ bool operator<(const XMLObjectChildrenIterator &_Right) const {
+ return (m_iter < _Right.m_iter);
+ }
+ /// @endcond
+ };
+
+ /**
+ * STL iterator that mediates access to an iterator that's a const pointer.
+ *
+ * @param Container type of container
+ * @param _Ty the type of object being referenced
+ */
+ template <class Container, typename _Ty>
+ class XMLObjectChildrenIterator<Container, const _Ty*>
+ {
+ /// @cond OFF
+ typename const _Ty* m_iter;
+ template <class _Tx, class _Tz> friend class XMLObjectChildrenList;
+ template <class _Tx, class _Tz> friend class XMLObjectPairList;
+ public:
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef _Ty value_type;
+ typedef ptrdiff_t difference_type;
+ typedef const _Ty* pointer;
+ typedef const _Ty& reference;
+ typedef const _Ty& const_reference;
+ typedef const _Ty* const_pointer;
+
+ XMLObjectChildrenIterator() {
+ }
+
+ XMLObjectChildrenIterator(_Ty* iter) {
+ m_iter=iter;
+ }
+
+ const_reference operator*() const {
+ return *m_iter;
+ }
+
+ const_reference operator->() const {
+ return *m_iter;
+ }
+
+ XMLObjectChildrenIterator& operator++() {
+ // preincrement
+ ++m_iter;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator& operator--() {
+ // predecrement
+ --m_iter;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator operator++(int) {
+ // postincrement
+ XMLObjectChildrenIterator _Tmp = *this;
+ ++*this;
+ return (_Tmp);
+ }
+
+ XMLObjectChildrenIterator operator--(int) {
+ // postdecrement
+ XMLObjectChildrenIterator _Tmp = *this;
+ --*this;
+ return (_Tmp);
+ }
+
+ XMLObjectChildrenIterator& operator+=(difference_type _Off) {
+ // increment by integer
+ m_iter += _Off;
+ return (*this);
+ }
+
+ XMLObjectChildrenIterator operator+(difference_type _Off) const {
+ // return this + integer
+ return m_iter + _Off;
+ }
+
+ XMLObjectChildrenIterator& operator-=(difference_type _Off) {
+ // decrement by integer
+ return (*this += -_Off);
+ }
+
+ XMLObjectChildrenIterator operator-(difference_type _Off) const {
+ // return this - integer
+ XMLObjectChildrenIterator _Tmp = *this;
+ return (_Tmp -= _Off);
+ }
+
+ difference_type operator-(const XMLObjectChildrenIterator& _Right) const {
+ // return difference of iterators
+ return m_iter - _Right.m_iter;
+ }
+
+ const_reference operator[](difference_type _Off) const {
+ // subscript
+ return (*(*this + _Off));
+ }
+
+ bool operator==(const XMLObjectChildrenIterator &_Right) const {
+ // test for iterator equality
+ return (m_iter == _Right.m_iter);
+ }
+
+ bool operator!=(const XMLObjectChildrenIterator &_Right) const {
+ // test for iterator inequality
+ return (!(m_iter == _Right.m_iter));
+ }
+
+ bool operator<(const XMLObjectChildrenIterator &_Right) const {
+ return (m_iter < _Right.m_iter);
+ }
/// @endcond
};
+#endif
/**
* STL-compatible container that mediates access to underlying lists of typed XML children.
typedef typename Container::size_type size_type;
// We override the iterator types with our constrained wrapper.
- typedef XMLObjectChildrenIterator<Container> iterator;
- typedef XMLObjectChildrenIterator<Container> const_iterator;
+ typedef XMLObjectChildrenIterator<Container, typename Container::iterator> iterator;
+ typedef XMLObjectChildrenIterator<Container, typename Container::const_iterator> const_iterator;
/// @endcond
/**
const_iterator begin() const {
// return iterator for beginning of const sequence
- return m_container.begin();
+ return const_cast<const Container&>(m_container).begin();
}
const_iterator end() const {
// return iterator for end of const sequence
- return m_container.end();
+ return const_cast<const Container&>(m_container).end();
}
const_reference at(size_type _Pos) const {
typedef typename Container::size_type size_type;
// We override the iterator types with our constrained wrapper.
- typedef XMLObjectChildrenIterator<Container> iterator;
- typedef XMLObjectChildrenIterator<Container> const_iterator;
+ typedef XMLObjectChildrenIterator<Container, typename Container::iterator> iterator;
+ typedef XMLObjectChildrenIterator<Container, typename Container::const_iterator> const_iterator;
/// @endcond
/**
const_iterator begin() const {
// return iterator for beginning of const sequence
- return m_container.begin();
+ return const_cast<const Container&>(m_container).begin();
}
const_iterator end() const {
// return iterator for end of const sequence
- return m_container.end();
+ return const_cast<const Container&>(m_container).end();
}
const_reference at(size_type _Pos) const {
RelativePath=".\io\AbstractXMLObjectUnmarshaller.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath=".\io\HTTPRequest.cpp"\r
+ >\r
+ </File>\r
</Filter>\r
<Filter\r
Name="impl"\r
>\r
</File>\r
<File\r
+ RelativePath=".\util\Predicates.h"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\util\ReloadableXMLFile.h"\r
>\r
</File>\r
RelativePath=".\io\AbstractXMLObjectUnmarshaller.cpp"\r
>\r
</File>\r
+ <File\r
+ RelativePath=".\io\HTTPRequest.cpp"\r
+ >\r
+ </File>\r
</Filter>\r
<Filter\r
Name="impl"\r
>\r
</File>\r
<File\r
+ RelativePath=".\util\Predicates.h"\r
+ >\r
+ </File>\r
+ <File\r
RelativePath=".\util\ReloadableXMLFile.h"\r
>\r
</File>\r
try {
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::ENCRYPTION_CREDENTIAL);
+ cc.setUsage(Credential::ENCRYPTION_CREDENTIAL);
Locker locker(m_resolver);
const Credential* cred=m_resolver->resolve(&cc);
TSM_ASSERT("Retrieved credential was null", cred!=NULL);
sig->setContentReference(new TestContext(&chNull));
CredentialCriteria cc;
- cc.setUsage(CredentialCriteria::SIGNING_CREDENTIAL);
+ cc.setUsage(Credential::SIGNING_CREDENTIAL);
Locker locker(m_resolver);
const Credential* cred = m_resolver->resolve(&cc);
TSM_ASSERT("Retrieved credential was null", cred!=NULL);