--- xmltooling-1.0.orig/debian/copyright +++ xmltooling-1.0/debian/copyright @@ -0,0 +1,216 @@ +Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat +Upstream-Author: Internet2 +Packaged-By: Ferenc Wágner +Packaged-Date: Mon, 28 Apr 2008 14:55:31 +0200 +Original-Source-Location: + http://shibboleth.internet2.edu/downloads/opensaml/cpp/2.0/ + +Files: * +Copyright: 2001-2007 Internet2 +License: Apache-2.0 + +Files: */Makefile.in +Copyright: 2001-2007 Internet2 + 2004 Oren Ben-Kiki + 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Free Software Foundation, Inc. +License: other + This Makefile.in is free software; the Free Software Foundation + gives unlimited permission to copy and/or distribute it, + with or without modifications, as long as this notice is preserved. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, to the extent permitted by law; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. + +Files: ./aclocal.m4 +Copyright: 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. +License: other + This file is free software; the Free Software Foundation + gives unlimited permission to copy and/or distribute it, + with or without modifications, as long as this notice is preserved. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, to the extent permitted by law; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. + +Files: ./acx_pthread.m4 +Copyright: 2006 Steven G. Johnson +License: GPL-2+ | other + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details. + . + The full text of the GNU General Public License version 2 is available on + Debian systems in /usr/share/common-licenses/GPL-2. + . + As a special exception, the respective Autoconf Macro's copyright owner + gives unlimited permission to copy, distribute and modify the configure + scripts that are the output of Autoconf when processing the Macro. You + need not follow the terms of the GNU General Public License when using or + distributing such scripts, even though portions of the text of the Macro + appear in them. The GNU General Public License (GPL) does govern all + other use of the material that constitutes the Autoconf Macro. + . + This special exception to the GPL applies to versions of the Autoconf + Macro released by the Autoconf Macro Archive. When you make and + distribute a modified version of the Autoconf Macro, you may extend this + special exception to the GPL to apply to your modified version as well. + +Files: ./config.guess, ./config.sub, ./depcomp, ./libtool.m4, ./ltmain.sh + ./missing +Copyright: 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +License: GPL-2+ | other + This file is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + Public License for more details. + . + The full text of the GNU General Public License version 2 is available on + Debian systems in /usr/share/common-licenses/GPL-2. + . + As a special exception to the GNU General Public License, if you + distribute this file as part of a program that contains a configuration + script generated by Autoconf, you may include it under the same + distribution terms that you use for the rest of that program. + +Files: ./configure +Copyright: 2003 Free Software Foundation, Inc. +License: other + This configure script is free software; the Free Software Foundation + gives unlimited permission to copy, distribute and modify it. + +Files: ./debian/* +Copyright: 2008 Ferenc Wágner + 2008 Russ Allbery +License: Expat + +Files: ./doxygen.{am,m4} +Copyright: 2004 Oren Ben-Kiki +License: other + This file is free software; the Free Software Foundation + gives unlimited permission to copy and/or distribute it, + with or without modifications, as long as this notice is preserved. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY, to the extent permitted by law; without + even the implied warranty of MERCHANTABILITY or FITNESS FOR A + PARTICULAR PURPOSE. + +Files: ./install-sh +Copyright: (C) 1994 X Consortium +License: Expat + +Files: ./schemas/soap-envelope.xsd +Copyright: 2001 Martin Gudgin, Developmentor + 2001 W3C (Massachusetts Institute of Technology, Institut National de + Recherche en Informatique et en Automatique, Keio University) All Rights + Reserved. http://www.w3.org/Consortium/Legal/ +License: W3C-Software + +Files: ./schemas/xml.xsd, ./schemas/xmldsig-core-schema.xsd +Copyright: 2001 W3C (Massachusetts Institute of Technology, Institut + National de Recherche en Informatique et en Automatique, Keio University) + All Rights Reserved. http://www.w3.org/Consortium/Legal/ +License: W3C-Software + +Files: ./xmltooling/security/*X509CRL.h, + ./xmltooling/security/impl/*X509CRL.cpp, ./xmltooling/util/Curl* +Copyright: 1999-2007 The Apache Software Foundation +License: Apache-2.0 + +License: Apache-2.0 + 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. + . + On Debian systems, the complete text of the Apache 2.0 license can be + found in the file /usr/share/common-licenses/Apache-2.0. + +License: Expat + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + . + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + . + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: W3C-Software + This W3C work (including software, documents, or other related items) is + being provided by the copyright holders under the following license. By + obtaining, using and/or copying this work, you (the licensee) agree that + you have read, understood, and will comply with the following terms and + conditions: + . + Permission to use, copy, modify, and distribute this software and its + documentation, with or without modification, for any purpose and without + fee or royalty is hereby granted, provided that you include the following + on ALL copies of the software and documentation or portions thereof, + including modifications, that you make: + . + 1. The full text of this NOTICE in a location viewable to users of the + redistributed or derivative work. + . + 2. Any pre-existing intellectual property disclaimers, notices, or terms + and conditions. If none exist, a short notice of the following form + (hypertext is preferred, text is permitted) should be used within the + body of any redistributed or derivative code: "Copyright © + [$date-of-software] World Wide Web Consortium, (Massachusetts + Institute of Technology, Institut National de Recherche en + Informatique et en Automatique, Keio University). All Rights Reserved. + http://www.w3.org/Consortium/Legal/" + . + 3. Notice of any changes or modifications to the W3C files, including the + date changes were made. (We recommend you provide URIs to the location + from which the code is derived.) + . + THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT + HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS + FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR + DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, + TRADEMARKS OR OTHER RIGHTS. + . + COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR + CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR + DOCUMENTATION. + . + The name and trademarks of copyright holders may NOT be used in + advertising or publicity pertaining to the software without specific, + written prior permission. Title to copyright in this software and any + associated documentation will at all times remain with copyright holders. --- xmltooling-1.0.orig/debian/libxmltooling-doc.install +++ xmltooling-1.0/debian/libxmltooling-doc.install @@ -0,0 +1 @@ +doc/api/* usr/share/doc/libxmltooling-doc --- xmltooling-1.0.orig/debian/libxmltooling-doc.doc-base +++ xmltooling-1.0/debian/libxmltooling-doc.doc-base @@ -0,0 +1,13 @@ +Document: libxmltooling-doc +Title: XMLTooling-C API documentation +Author: Scott Cantor +Abstract: Doxygen generated HTML documentation of the XMLTooling-C + library version 1. +Section: Programming/C++ + +Format: HTML +Index: /usr/share/doc/libxmltooling-doc/html/index.html +Files: /usr/share/doc/libxmltooling-doc/html/*.html + /usr/share/doc/libxmltooling-doc/html/*.png + /usr/share/doc/libxmltooling-doc/html/*.gif + /usr/share/doc/libxmltooling-doc/html/*.css --- xmltooling-1.0.orig/debian/libxmltooling-dev.install +++ xmltooling-1.0/debian/libxmltooling-dev.install @@ -0,0 +1,2 @@ +debian/tmp/usr/include/* +debian/tmp/usr/lib/lib*.so --- xmltooling-1.0.orig/debian/rules +++ xmltooling-1.0/debian/rules @@ -0,0 +1,101 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. +# +# Modified to make a template file for a multi-binary package with separated +# build-arch and build-indep targets by Bill Allombert 2001 + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + DEBUG = --enable-debug +else + DEBUG = +endif + +# Tell Autoconf the correct system types. +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) + SYSTEM = --build $(DEB_HOST_GNU_TYPE) +else + SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + cp /usr/share/misc/config.guess config.guess + cp /usr/share/misc/config.sub config.sub + CFLAGS="$(CFLAGS)" LIBS=-lpthread ./configure --prefix=/usr \ + --disable-dependency-tracking $(SYSTEM) $(DEBUG) + touch $@ + +build: build-arch build-indep +build-arch: build-stamp +build-indep: +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f configure-stamp build-stamp install-stamp + [ ! -f Makefile ] || $(MAKE) distclean + dh_clean config.guess config.sub + +install: install-stamp +install-stamp: + dh_testdir + dh_testroot + dh_clean -k + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install + rm -r $(CURDIR)/debian/tmp/usr/share/doc/xmltooling + dh_install -a -i --fail-missing + touch $@ + +binary: binary-arch binary-indep +binary-arch: DH_OPTIONS=-a +binary-arch: install-stamp + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs -A doc/NOTICE.txt + dh_link + dh_strip + dh_compress + dh_fixperms + dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-indep: DH_OPTIONS=-i +binary-indep: install-stamp + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs -A doc/NOTICE.txt + dh_link + dh_compress + dh_fixperms + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +.PHONY: binary binary-arch binary-indep build build-arch build-indep clean +.PHONY: install --- xmltooling-1.0.orig/debian/watch +++ xmltooling-1.0/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://shibboleth.internet2.edu/downloads/opensaml/cpp/2.0/xmltooling-(.*)\.tar\.gz --- xmltooling-1.0.orig/debian/compat +++ xmltooling-1.0/debian/compat @@ -0,0 +1 @@ +5 --- xmltooling-1.0.orig/debian/changelog +++ xmltooling-1.0/debian/changelog @@ -0,0 +1,44 @@ +xmltooling (1.0-2+lenny1) stable-security; urgency=high + + * SECURITY: Certificate subject names were incorrectly matched against + trusted "key names" when they contained nul characters. This affects + only Shibboleth deployments relying on the "PKIX" style of trust + validation, used in the absence of explicit certificate information in + the SAML metadata provided to the SP and reliance on certificate + authorities found in the metadata extension element. + See + * SECURITY: Correctly handle decoding of malformed URLs, closing a + possibly exploitable buffer overflow. + See + * SECURITY: Correctly honor the "use" attribute of SAML + metadata to honor restrictions to signing or encryption. This is a + partial fix; the complete fix also requires a new version of the + OpenSAML library. + See + + -- Russ Allbery Tue, 22 Sep 2009 19:23:54 -0700 + +xmltooling (1.0-2) unstable; urgency=low + + [ Ferenc Wagner ] + * Add dependencies to libxmltooling-dev for the packages whose header + files are included by XMLTooling headers. + * Include NOTICE.txt in all packages. + + [ Russ Allbery ] + * Explicitly link with -lpthread to work around Bug#468555 in libtool. + * Change package priorities to extra. Xerces-C is extra, so all of the + Shibboleth stack needs to be extra, and realistically it's somewhat of + an edge package in Debian. + * Add in copyright and license information for all of the other random + files in the tree, including all the Autoconf support files. + * Fix copyright file formatting to use the right syntax for Files. + + -- Russ Allbery Wed, 18 Jun 2008 20:18:21 -0700 + +xmltooling (1.0-1) unstable; urgency=low + + [ Ferenc Wagner ] + * Initial release (Closes: #480287) + + -- Russ Allbery Sat, 07 Jun 2008 13:00:13 -0700 --- xmltooling-1.0.orig/debian/control +++ xmltooling-1.0/debian/control @@ -0,0 +1,66 @@ +Source: xmltooling +Section: libs +Priority: extra +Maintainer: Debian Shib Team +Uploaders: Russ Allbery , Ferenc Wagner +Build-Depends: debhelper (>= 5), autotools-dev, doxygen, + libcurl4-openssl-dev, liblog4cpp5-dev, libxerces-c2-dev, + libxml-security-c-dev (>= 1.4) +Standards-Version: 3.8.0 +Homepage: https://spaces.internet2.edu/display/OpenSAML/XMLTooling-C +Vcs-Git: git://git.debian.org/git/pkg-shibboleth/xmltooling.git +Vcs-Browser: http://git.debian.org/?p=pkg-shibboleth/xmltooling.git + +Package: libxmltooling1 +Section: libs +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: C++ XML parsing library with encryption support (runtime) + The XMLTooling library contains generic XML parsing and processing + classes based on the Xerces-C DOM. It adds more powerful facilities for + declaring element- and type-specific API and implementation classes, as + well as signing and encryption support. + . + This package contains the files necessary for running applications that + use the XMLTooling library. + +Package: libxmltooling-dev +Section: libdevel +Architecture: any +Depends: libxmltooling1 (= ${binary:Version}), libcurl4-openssl-dev, + liblog4cpp5-dev, libxerces-c2-dev, libxml-security-c-dev (>= 1.4) +Suggests: libxmltooling-doc (= ${source:Version}) +Description: C++ XML parsing library with encryption support (development) + The XMLTooling library contains generic XML parsing and processing + classes based on the Xerces-C DOM. It adds more powerful facilities + for declaring element- and type-specific API and implementation + classes to add value around the DOM, as well as signing and encryption + support. + . + This package contains the headers and other necessary files to build + applications or libraries that use or extend the XMLTooling library. + +Package: xmltooling-schemas +Section: text +Architecture: all +Description: XML schemas for XMLTooling + The XMLTooling library contains generic XML parsing and processing + classes based on the Xerces-C DOM. It adds more powerful facilities for + declaring element- and type-specific API and implementation classes, as + well as signing and encryption support. + . + This package contains the XML schema files used by the XMLTooling + library. + +Package: libxmltooling-doc +Section: doc +Architecture: all +Description: C++ XML parsing library with encryption support (API docs) + The XMLTooling library contains generic XML parsing and processing + classes based on the Xerces-C DOM. It adds more powerful facilities + for declaring element- and type-specific API and implementation + classes to add value around the DOM, as well as signing and encryption + support. + . + This package contains the XMLTooling library API documentation generated + by Doxygen. --- xmltooling-1.0.orig/debian/xmltooling-schemas.install +++ xmltooling-1.0/debian/xmltooling-schemas.install @@ -0,0 +1 @@ +debian/tmp/usr/share/xml/xmltooling --- xmltooling-1.0.orig/debian/libxmltooling1.install +++ xmltooling-1.0/debian/libxmltooling1.install @@ -0,0 +1 @@ +debian/tmp/usr/lib/lib*.so.* --- xmltooling-1.0.orig/xmltooling/XMLObjectBuilder.h +++ xmltooling-1.0/xmltooling/XMLObjectBuilder.h @@ -24,6 +24,7 @@ #define __xmltooling_xmlobjbuilder_h__ #include +#include #include #include #include --- xmltooling-1.0.orig/xmltooling/exceptions.cpp +++ xmltooling-1.0/xmltooling/exceptions.cpp @@ -27,6 +27,7 @@ #include "util/XMLConstants.h" #include "util/XMLHelper.h" +#include #include #include #include --- xmltooling-1.0.orig/xmltooling/AbstractDOMCachingXMLObject.cpp +++ xmltooling-1.0/xmltooling/AbstractDOMCachingXMLObject.cpp @@ -28,6 +28,7 @@ #include #include +#include using namespace xmltooling; using namespace std; --- xmltooling-1.0.orig/xmltooling/base.h +++ xmltooling-1.0/xmltooling/base.h @@ -30,6 +30,8 @@ #include #endif +#include + #ifdef XMLTOOLING_LITE # define XMLTOOLING_NO_XMLSEC 1 #endif --- xmltooling-1.0.orig/xmltooling/encryption/impl/Decrypter.cpp +++ xmltooling-1.0/xmltooling/encryption/impl/Decrypter.cpp @@ -28,6 +28,7 @@ #include "security/CredentialCriteria.h" #include "security/CredentialResolver.h" +#include #include #include #include --- xmltooling-1.0.orig/xmltooling/encryption/impl/Encrypter.cpp +++ xmltooling-1.0/xmltooling/encryption/impl/Encrypter.cpp @@ -24,6 +24,7 @@ #include "encryption/Encrypter.h" #include "security/Credential.h" +#include #include #include #include --- xmltooling-1.0.orig/xmltooling/security/impl/InlineKeyResolver.cpp +++ xmltooling-1.0/xmltooling/security/impl/InlineKeyResolver.cpp @@ -32,6 +32,7 @@ #include "util/XMLConstants.h" #include "validation/ValidatorSuite.h" +#include #include #include #include @@ -94,7 +95,7 @@ return ret; } - const CredentialContext* getCredentialContext() const { + const CredentialContext* getCredentalContext() const { return m_credctx; } --- xmltooling-1.0.orig/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp +++ xmltooling-1.0/xmltooling/security/impl/AbstractPKIXTrustEngine.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ #include "security/AbstractPKIXTrustEngine.h" #include "signature/KeyInfo.h" +#include #include #include #include @@ -152,38 +153,37 @@ for (vector::const_iterator cred = creds.begin(); cred!=creds.end(); ++cred) trustednames.insert((*cred)->getKeyNames().begin(), (*cred)->getKeyNames().end()); - char buf[256]; X509_NAME* subject=X509_get_subject_name(certEE); if (subject) { // One way is a direct match to the subject DN. // Seems that the way to do the compare is to write the X509_NAME into a BIO. BIO* b = BIO_new(BIO_s_mem()); BIO* b2 = BIO_new(BIO_s_mem()); - BIO_set_mem_eof_return(b, 0); - BIO_set_mem_eof_return(b2, 0); // The flags give us LDAP order instead of X.500, with a comma separator. - int len=X509_NAME_print_ex(b,subject,0,XN_FLAG_RFC2253); - string subjectstr,subjectstr2; + X509_NAME_print_ex(b,subject,0,XN_FLAG_RFC2253); BIO_flush(b); - while ((len = BIO_read(b, buf, 255)) > 0) { - buf[len] = '\0'; - subjectstr+=buf; - } - 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); + X509_NAME_print_ex(b2,subject,0,XN_FLAG_RFC2253 + XN_FLAG_SEP_CPLUS_SPC - XN_FLAG_SEP_COMMA_PLUS); BIO_flush(b2); - while ((len = BIO_read(b2, buf, 255)) > 0) { - buf[len] = '\0'; - subjectstr2+=buf; + + BUF_MEM* bptr=NULL; + BUF_MEM* bptr2=NULL; + BIO_get_mem_ptr(b, &bptr); + BIO_get_mem_ptr(b2, &bptr2); + + if (bptr && bptr->length > 0 && log.isDebugEnabled()) { + string subjectstr(bptr->data, bptr->length); + log.debug("certificate subject: %s", subjectstr.c_str()); } // Check each keyname. - for (set::const_iterator n=trustednames.begin(); n!=trustednames.end(); n++) { + for (set::const_iterator n=trustednames.begin(); bptr && bptr2 && n!=trustednames.end(); n++) { #ifdef HAVE_STRCASECMP - if (!strcasecmp(n->c_str(),subjectstr.c_str()) || !strcasecmp(n->c_str(),subjectstr2.c_str())) { + if ((n->length() == bptr->length && !strncasecmp(n->c_str(), bptr->data, bptr->length)) || + (n->length() == bptr2->length && !strncasecmp(n->c_str(), bptr2->data, bptr2->length))) { #else - if (!stricmp(n->c_str(),subjectstr.c_str()) || !stricmp(n->c_str(),subjectstr2.c_str())) { + if ((n->length() == bptr->length && !strnicmp(n->c_str(), bptr->data, bptr->length)) || + (n->length() == bptr2->length && !strnicmp(n->c_str(), bptr2->data, bptr2->length))) { #endif log.debug("matched full subject DN to a key name (%s)", n->c_str()); BIO_free(b); @@ -205,11 +205,11 @@ const int altlen = ASN1_STRING_length(check->d.ia5); for (set::const_iterator n=trustednames.begin(); n!=trustednames.end(); n++) { #ifdef HAVE_STRCASECMP - if ((check->type==GEN_DNS && !strncasecmp(altptr,n->c_str(),altlen)) + if ((check->type==GEN_DNS && n->length()==altlen && !strncasecmp(altptr,n->c_str(),altlen)) #else - if ((check->type==GEN_DNS && !strnicmp(altptr,n->c_str(),altlen)) + if ((check->type==GEN_DNS && n->length()==altlen && !strnicmp(altptr,n->c_str(),altlen)) #endif - || (check->type==GEN_URI && !strncmp(altptr,n->c_str(),altlen))) { + || (check->type==GEN_URI && n->length()==altlen && !strncmp(altptr,n->c_str(),altlen))) { log.debug("matched DNS/URI subjectAltName to a key name (%s)", n->c_str()); GENERAL_NAMES_free(altnames); return true; @@ -221,24 +221,52 @@ GENERAL_NAMES_free(altnames); log.debug("unable to match subjectAltName, trying TLS CN match"); - memset(buf,0,sizeof(buf)); - if (X509_NAME_get_text_by_NID(subject,NID_commonName,buf,255)>0) { + + // Fetch the last CN RDN. + char* peer_CN = NULL; + int j,i = -1; + while ((j=X509_NAME_get_index_by_NID(subject, NID_commonName, i)) >= 0) + i = j; + if (i >= 0) { + ASN1_STRING* tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subject, i)); + // Copied in from libcurl. + /* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input + is already UTF-8 encoded. We check for this case and copy the raw + string manually to avoid the problem. */ + if(tmp && ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) { + j = ASN1_STRING_length(tmp); + if(j >= 0) { + peer_CN = (char*)OPENSSL_malloc(j + 1); + memcpy(peer_CN, ASN1_STRING_data(tmp), j); + peer_CN[j] = '\0'; + } + } + else /* not a UTF8 name */ { + j = ASN1_STRING_to_UTF8(reinterpret_cast(&peer_CN), tmp); + } + for (set::const_iterator n=trustednames.begin(); n!=trustednames.end(); n++) { #ifdef HAVE_STRCASECMP - if (!strcasecmp(buf,n->c_str())) { + if (n->length() == j && !strncasecmp(peer_CN, n->c_str(), j)) { #else - if (!stricmp(buf,n->c_str())) { + if (n->length() == j && !strnicmp(peer_CN, n->c_str(), j)) { #endif log.debug("matched subject CN to a key name (%s)", n->c_str()); + if(peer_CN) + OPENSSL_free(peer_CN); return true; } } + if(peer_CN) + OPENSSL_free(peer_CN); } - else + else { log.warn("no common name in certificate subject"); + } } - else + else { log.error("certificate has no subject?!"); + } return false; } --- xmltooling-1.0.orig/xmltooling/io/AbstractXMLObjectUnmarshaller.cpp +++ xmltooling-1.0/xmltooling/io/AbstractXMLObjectUnmarshaller.cpp @@ -28,6 +28,7 @@ #include "util/XMLConstants.h" #include "util/XMLHelper.h" +#include #include using namespace xmlconstants; --- xmltooling-1.0.orig/xmltooling/impl/AnyElement.cpp +++ xmltooling-1.0/xmltooling/impl/AnyElement.cpp @@ -26,6 +26,7 @@ #include "util/NDC.h" #include "util/XMLHelper.h" +#include #include using namespace xmltooling; --- xmltooling-1.0.orig/xmltooling/impl/MemoryStorageService.cpp +++ xmltooling-1.0/xmltooling/impl/MemoryStorageService.cpp @@ -27,6 +27,7 @@ #include "util/Threads.h" #include "util/XMLHelper.h" +#include #include using namespace xmltooling::logging; --- xmltooling-1.0.orig/xmltooling/soap/impl/SOAPClient.cpp +++ xmltooling-1.0/xmltooling/soap/impl/SOAPClient.cpp @@ -28,6 +28,7 @@ #include "util/XMLHelper.h" #include "validation/ValidatorSuite.h" +#include #include using namespace soap11; @@ -89,8 +90,11 @@ XercesJanitor janitor(doc); Category& log = Category::getInstance(XMLTOOLING_LOGCAT".SOAPClient"); - if (log.isDebugEnabled()) - log.debugStream() << "received XML:\n" << *(doc->getDocumentElement()) << logging::eol; + if (log.isDebugEnabled()) { + string serializedXml; + XMLHelper::serialize (doc->getDocumentElement(),serializedXml,false); + log.debugStream() << "received XML:\n" << serializedXml << logging::eol; + } auto_ptr xmlObject(XMLObjectBuilder::buildOneFromElement(doc->getDocumentElement(), true)); janitor.release(); --- xmltooling-1.0.orig/xmltooling/util/URLEncoder.cpp +++ xmltooling-1.0/xmltooling/util/URLEncoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007 Internet2 + * Copyright 2001-2009 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ for(x=0,y=0;s[y];++x,++y) { - if((s[x] = s[y]) == '%') + if((s[x] = s[y]) == '%' && isxdigit(s[y+1]) && isxdigit(s[y+2])) { s[x] = x2c(&s[y+1]); y+=2;