Free software C library wich implements SAML 2.0 and Liberty Alliance standards
Go to file
John Dennis 247b69b1cf fix test08_lasso_key test failure
Note: the rest of this message is formatted as reStructuredText (rst).

Test Failure
============

The unit tests run by "make check" fail with the following error:

::

    tests.c:61:F:Lasso keys:test08_lasso_key:0: No logging output expected: message «ID _E3F8E9116EE08F0E2607CF9789649BB4 already defined
    » was emitted for domain «Lasso» at the level «128»

This is not a regression in Lasso, rather the failure is caused by one
of the components Lasso is dependent upon. It was first observed when
the identical Lasso package was built in Fedora 22, no problems were
observed in Fedora 21. This implies one or more updated components in
Fedora 22 is the cause.

This was a particularity difficult error to track down, first one had
to identify who was emitting the message and on what file descriptor
(stream) and who was triggering on the message emission and causing a
check failure. The obvious assumption the check library was
responsible for detecting the message emission and failing the test is
wrong.

Who is emitting the message and why?
------------------------------------

The message is emitted by libxml2 in the function `xmlAddID()`
(valid.c:2578). It occurs at the end of xmlAddID() when it detects the
ID (which is supposed to be unique to the document is already defined,
which for valid XML is illegal (violates uniquenesss constraint). The
message emission occurs because of the code fragment

::

        if (xmlHashAddEntry(table, value, ret) < 0) {
    #ifdef LIBXML_VALID_ENABLED
            /*
             * The id is already defined in this DTD.
             */
            xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
                            "ID %s already defined\n", value, NULL, NULL);
    #endif /* LIBXML_VALID_ENABLED */
            xmlFreeID(ret);
            return(NULL);
        }

Why is the message emission different between libxml2 versions?
---------------------------------------------------------------

The change occured between libxml2 version 2.9.1 and 2.9.2 in commit
a16eb968075a82ec33b2c1e77db8909a35b44620

::

    commit a16eb968075a82ec33b2c1e77db8909a35b44620
    Author: Daniel Veillard <veillard@redhat.com>
    Date:   Tue Jun 10 16:06:14 2014 +0800

        erroneously ignores a validation error if no error callback set

        Reported by Stefan Behnel
        https://bugzilla.gnome.org/show_bug.cgi?id=724903

    diff --git a/valid.c b/valid.c
    index aedd9d7..1e03a7c 100644
    --- a/valid.c
    +++ b/valid.c
    @@ -2633,11 +2633,8 @@ xmlAddID(xmlValidCtxtPtr ctxt, xmlDocPtr doc, const xmlChar *value,
            /*
             * The id is already defined in this DTD.
             */
    -	if ((ctxt != NULL) && (ctxt->error != NULL)) {
    -	    xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
    -	                    "ID %s already defined\n",
    -			    value, NULL, NULL);
    -	}
    +	xmlErrValidNode(ctxt, attr->parent, XML_DTD_ID_REDEFINED,
    +			"ID %s already defined\n", value, NULL, NULL);
     #endif /* LIBXML_VALID_ENABLED */
            xmlFreeID(ret);
            return(NULL);

In both versions of libxml2 the conditional complilation
LIBXML_VALID_ENABLED is enabled by default via the configure
script. What is different is the the requirement ctxt be
non-NULL. Lasso invokes xmlAddID with a NULL ctxt parameter. Because
the NULL test for ctxt is absent in libxlm2 2.9.2 the message is now
emitted where previously it was not.

Who triggers on messge emission and fails the test?
---------------------------------------------------

This is a Lasso feature, it is not part of libcheck. In tests/tests.c
is the following function

::

    void error_logger(const gchar *log_domain, GLogLevelFlags log_level,
                    const gchar *message, G_GNUC_UNUSED gpointer user_data)
    {
            fail("No logging output expected: message «%s» was emitted for domain «%s» at the level"
                            " «%d»", message, log_domain, log_level);
    }

Before the test are run the error_logger function is installed as a
glib handler

::

    g_log_set_default_handler(error_logger, NULL);

When the message is emitted the error_logger traps it and invokes the
libcheck (deprecated) function fail() which aborts the test case.

Why does `test08_lasso_key` cause an XML validation failure?
------------------------------------------------------------

`test08_lasso_key` invokes `lasso_key_saml2_xml_verify()` twice on the
same XML document. Any time `lasso_key_saml2_xml_verify()` is called
more than once the XML validation will fail on the second and
subsequent invocations. This occurs because
`lasso_key_saml2_xml_verify()` invokes `lasso_verify_signature()`
passing it the node id in the `id_attr_name` parameter. Inside
`lasso_verify_signature()` is this code fragment:

::

	/* Find ID */
	if (id_attr_name) {
		id = xmlGetProp(signed_node, (xmlChar*)id_attr_name);
		if (id) {
			xmlAddID(NULL, doc, id, xmlHasProp(signed_node, (xmlChar*)id_attr_name));
		}
	}

Note that it unconditionally invokes `xmlAddID()`, which adds the ID
to the set of unique element ID's in the document. But if you invoke
`xmlAddID()` more than once with the same ID in the same document you
violate the uniqueness constraint.

The ID needs to be registered in the document because the <Reference>
element of the <SignedInfo> may utilize an XPointer reference to the
signed data. In it's simplest form the XPointer reference is an ID
attribute on a node. Thus to locate the signed data referenced by the
ID it should (must?) be in a table of ID's for the document.

Simple Solution (patch)
-----------------------

The solution is simple now that the problem is understood. The ID
should not be unconditionally added to the document, instead it should
only be added if it's not already registered. Prior to calling
`xmlAddID()` one should call `xmlGetID()` and test for a NULL result
indicating the ID has not be registered previously.

Signed-off-by: John Dennis <jdennis@redhat.com>
License: MIT
2015-09-01 16:32:42 +02:00
abi more work toward release 2.4.0 2013-12-19 09:00:17 +01:00
bindings bindings/java: fix test script generation 2015-08-24 16:18:33 +02:00
debian-jessie debian-jessie: add build dependency on pkg-config 2015-08-24 16:36:35 +02:00
debian-squeeze Add 'debian-squeeze/' from commit '33d67ddd1352a2db97d252c7d18f7806ec91e616' 2015-04-03 10:01:56 +02:00
debian-wheezy Add 'debian-wheezy/' from commit '0001ab9af1e3a7e19000a65b75ebc3c42f76a739' 2015-04-03 10:01:19 +02:00
docs Add function to set protocol conformance 2015-08-24 16:05:29 +02:00
examples/sp-cgi Improve top level commint in CGI script example 2014-10-17 23:02:12 +02:00
fedora configure.ac,fedora/lasso.spec: remove expat dependency 2013-12-19 10:14:52 +01:00
lasso fix test08_lasso_key test failure 2015-09-01 16:32:42 +02:00
logos Added Lasso logo. 2004-07-30 08:02:08 +00:00
m4 Fix license boilerplates 2013-12-03 21:55:06 +01:00
tests add ECP unit test 2015-08-24 16:05:29 +02:00
tools Add tool gitlog-to-changelog 2014-08-28 16:00:13 +02:00
website Release 2.4.1 2014-08-28 16:02:06 +02:00
win32 Fix license boilerplates 2013-12-03 21:55:06 +01:00
.gitignore Ignore some Perl binding files 2015-02-12 19:21:11 +01:00
AUTHORS Update AUHTORS file 2015-02-12 19:21:13 +01:00
COPYING Fix license boilerplates 2013-12-03 21:55:06 +01:00
ChangeLog Mention Python 3 support in the changelog 2015-02-12 19:21:12 +01:00
FAQ.rst FAQ: add section about getting the issuer before parsing the received message (#4378) 2015-08-24 10:25:03 +02:00
HACKING limit line length to 100 characters. 2004-11-25 22:25:51 +00:00
INSTALL Python 3: Fix Python 2 support (use six.print_) 2015-02-12 19:21:12 +01:00
Makefile.am configure: generate version number from git revision between tagged release 2013-05-15 11:28:25 +02:00
NEWS Fix release date of 2.4.1 2014-08-28 17:20:18 +02:00
README Fix license boilerplates 2013-12-03 21:55:06 +01:00
README.JAVA [Core] complete README.JAVA about later release of gcj 2010-07-21 13:57:00 +00:00
README.WIN32 fixing minor typo 2006-12-27 14:59:40 +00:00
autogen.sh add support for automake 1.15 2015-09-01 16:32:42 +02:00
configure.ac configure.ac: move test framework detection after pkg-config detection 2015-08-24 16:57:49 +02:00
jenkins.sh jenkins.sh: do not ignore errors 2013-11-20 08:49:00 +01:00
lasso-src-config.in Perl module builds and links correctly. 2005-01-02 22:37:25 +00:00
lasso.doap [release] 2.3.6 2011-11-29 10:42:16 +01:00
lasso.pc.in pkgconfig: do not leak lasso dependencies to users 2013-03-07 13:52:03 +01:00

README

==============
Lasso Overview
==============

  Current homepage: <http://lasso.entrouvert.org>

Lasso (Liberty Alliance Single Sign-On) is a free (GNU GPL) implementation
of the Liberty Alliance specifications.  Those define processes for
federated identities, single sign-on and related protocols.  Lasso provides
both a C library and bindings for different languages.

  Liberty Alliance Project homepage: <http://www.project-liberty.org>


The latest version of Lasso can be found on the labs.libre-entreprise.org
website, <http://labs.libre-entreprise.org/frs/?group_id=31>


Lasso has several mailing lists:

- lasso-devel@lists.labs.libre-entreprise.org

  The mailing list for Lasso users and developers; discussions about both
  development and deployment of Lasso have their place on this list.

  <http://lists.labs.libre-entreprise.org/mailman/listinfo/lasso-devel>

- lasso-cvs-commits@lists.labs.libre-entreprise.org

  This list just distributes notices about commits to the Lasso CVS tree.
  It has no discussions, and it is not interesting unless you wish to
  take part in development.

  <http://lists.labs.libre-entreprise.org/mailman/listinfo/lasso-cvs-commits>

There is also a bug tracking system on the labs.libre-entreprise.org website,
  <http://labs.libre-entreprise.org/tracker/?atid=206&group_id=31>


Lasso was originally written by Nicolas Clapiès and Valéry Febvre.  Please
see the file AUTHORS_ for a list of major contributors, and the ChangeLog
for a detailed listing of all contributions.

::

  Copyright (c) 2004-2008 Entr'ouvert
  Excepted the Lasso logo, copyright (c) 2004, Entr'ouvert & Florent Monnier


  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.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.

  In addition, as a special exception, Entr'ouvert gives permission to link
  the code of its release of Lasso with the OpenSSL project's "OpenSSL"
  library (or with modified versions of it that use the same license as the
  "OpenSSL" library), and distribute the linked executables.  You must obey
  the GNU General Public License in all respects for all of the code used
  other than "OpenSSL".  If you modify this file, you may extend this
  exception to your version of the file, but you are not obligated to do so.
  If you do not wish to do so, delete this exception statement from your
  version.