Commit Graph

204 Commits

Author SHA1 Message Date
Benjamin Dauvergne b6faccae0f fix warnings about unused but set variables 2013-09-08 21:31:52 +02:00
Benjamin Dauvergne bd0f935a24 Rewrite all xmlNode serialization code to be compatible with libxml 2.9.0
Libxml stopped exposing the internal of the xmlOutputBuffer structure;
it was replace by proper use of the API and of the xmlBuffer structure.

There could be regression for older version of libxml as some functions
appeared in recent version of libxml; but the reference API document
does not give any introduction date for functions so it's hard to be
sure.
2012-09-28 22:58:24 +02:00
Benjamin Dauvergne 73a8c1faad [xml] fix typos 2012-05-05 22:51:43 +02:00
Benjamin Dauvergne f42bef0836 [key] add methods to send message using SAML 2.0 redirect and post bindings 2012-03-17 15:26:21 +01:00
Benjamin Dauvergne 08ec0a6fb7 Incompatibility with clang: local functions with closure does not work 2011-12-29 11:52:38 +01:00
Benjamin Dauvergne 154812b401 [xml] rewrite schema directed serialization/deserialization methods
The new implementations of lasso_node_impl_init_from_xml now validate
namespace of all child nodes befores parsing. It stops on any error. For
node which implement their own parsing of an attribute or a node, it
must declare an XmlSnippet with an offset field set to 0. The 0 value is
invalid for public GObject structure (it's the place of the GObject
machinery like the reference count). The 0 offset can be used for
XmlSnippet in a private structure, so never set the offset to 0 with the
flag SNIPPET_PRIVATE, for a field which is parsed by you get_xmlNode
virtual method.

Other ameliorations in this commit is the possibility to set attributes
with namespace when using the flags SNIPPET_ATTRIBUTE|SNIPPET_ANY. The
syntax for an attribute is inspired by the element tree API from Python:

	{namespace}attribute_name

an example:

	{http://www.w3.org/2001/XMLSchema-instance}type

for the classic xsi:type attribute.
2011-12-16 11:39:24 +01:00
Benjamin Dauvergne 900de512f2 [core] fix uninitialized pointer to a GError structure 2011-12-16 11:39:18 +01:00
Benjamin Dauvergne 5ba292521b [core] add the HMAC-SHA1 shared secret signature method 2011-12-05 13:11:53 +01:00
Benjamin Dauvergne 6c7114d5ce [core] refactor lasso_query_verify_signature and lasso_saml2_query_verify_signature
This commit introduces lasso_query_verify_helper which factorize
cryptographic operations.
2011-12-05 13:09:44 +01:00
Benjamin Dauvergne 2a63167627 [core] set the xmlSec log handler globally
The log handler is not set in lasso_init().
2011-12-05 12:03:13 +01:00
Benjamin Dauvergne 0c45b252dc [saml2] introduce a lasso_saml2_assertion_get_audirence_restrictions to factorize some code 2011-12-05 12:03:13 +01:00
Benjamin Dauvergne cd017964d0 [core] introduce the LassoSignatureContext context, to pass around signature parameters
This structure is used to pass around the signature algorithm
and the signature key.
2011-12-05 12:03:13 +01:00
Benjamin Dauvergne 71721b370c [core] add a lasso_base64_decode function 2011-12-05 12:03:13 +01:00
Benjamin Dauvergne e9212301d3 [tools] fix lasso_sha1 to return a glib allocated string 2011-12-05 12:03:13 +01:00
Benjamin Dauvergne 5a9a447bad [xml] add an inline function to validate LassoSignatureMethod values
- add also a LASSO_SIGNATURE_METHOD_NONE value
2011-12-05 12:03:12 +01:00
Benjamin Dauvergne fd7af65e91 [core] do not emit a warning for expected decryption errors
The only expected decryption error is on decryption of the symetric key
used to crypt the data. All other errors are critical and must be
logged.

Client of lasso_node_decrypt_xmlnode can then log the decryption failure
of the symetric if they tried with all possible keys (key rollover
case).
2011-11-22 18:51:49 +01:00
Benjamin Dauvergne 8b216a4307 [tools] redirect xmlsec errors to lasso error handler 2011-04-14 17:15:42 +02:00
Benjamin Dauvergne 890d88c8c5 [tools] use LASSO_LOG_DOMAIN instead of magic constant 2011-04-14 17:15:31 +02:00
Benjamin Dauvergne 6477d6043c [xml] if signature reference is empty check that signed node is the document root
An empty reference means the complete document, so the signed node is
the root element of this document. We must check that the parameter
signe_node dmatches our assumption.
2011-04-04 15:57:54 +02:00
Benjamin Dauvergne 04dd5610b0 [xml] allow empty reference in XML signature (document signature) 2011-03-29 18:43:47 +02:00
Benjamin Dauvergne e84a1e8a8a [xml] make id_attr_name parameter optional for lasso_verify_signature 2011-03-29 18:14:35 +02:00
Benjamin Dauvergne 447c610c9c [tools] fix xml decryption
This commit rewrite the extraction of the EncryptedKey when it is
embedded inside the EncryptedData element, which seem to be the frequent
case.
2010-12-14 01:58:38 +01:00
Benjamin Dauvergne 355df68dfe [saml2] use new encryption structure instead for internal field in LassoSaml2Assertion 2010-12-14 01:57:09 +01:00
Benjamin Dauvergne 462c9a1cd0 [Core] replace all use of g_strcmp0 by lasso_strisequal and lasso_strisnotequal
Too much human errors with strcmp kind of functions. Also change name os
lasso_is_empty_string to lasso_strisempty.
2010-10-01 15:29:38 +02:00
Benjamin Dauvergne 3631ad59a9 [XML] fix memleak of xmlSecKeyMngr when loading a key from a KeyInfo node 2010-09-17 17:02:40 +02:00
Benjamin Dauvergne c3985f6f6d [Core] add LAST enum values to LassoSignatureMethod and LassoSignatureType enumerations
It helps making range checks.
2010-09-03 19:02:41 +02:00
Benjamin Dauvergne ad93e9f831 [Core] Change lasso_apply_signature to use quark stored annotated signature parameters
The node containing signature do not handle the private keys passwords.
As the fields for signature parameters are part of the public ABI we
cannot add the password field to the public structure for those nodes.
Instead we use the new quark annotation accessed through
lasso_node_get/set_signature, and if the sign_type parameter is non-NULL
we use it instead of the parameters stored in the public structure.
This is a gross hack :( but at least it is documented.
2010-07-16 19:34:26 +00:00
Benjamin Dauvergne 21ca128532 [Core] add password parameter to lasso_sign_node 2010-07-16 19:34:24 +00:00
Benjamin Dauvergne c939427f21 [Core] add a password parameter to lasso_query_sign
We force use of the password through a custom OpenSSL password callback.
2010-07-16 19:34:21 +00:00
Benjamin Dauvergne 9d9cf60aca [Core] extract signature adding into base class method lasso_node_get_xmlNode
In order to permit subclass to modify the base xmlNode created by
lasso_node_impl_get_xmlNode we must defer the concrete to the virtual
method wrapper, lasso_node_get_xmlNode.

To do that it whas needed to make id_attribute another virtual field of
LassoNode subclasses (it can be accessed through an offset registered in
the class object).

This commit solves signature validation error since the patch for
managing more than one SessionIndex element in samlp2:LogoutRequest.

It also factorize the creation of signatures in one place.
2010-07-12 14:09:17 +00:00
Benjamin Dauvergne a9b673cd4a Core: move logging function and macros to their own module, adapt perl binding 2010-06-12 00:43:49 +00:00
Benjamin Dauvergne 93bea17474 Core: update lasso_iso_8601_gmt_to_time_t to support milliseconds
* We now support the two possible formats for xsdtime XSchema datatype:
    - dddd-dd-ddTdd:dd:ddZ
    - dddd-dd-ddTdd:dd:dd.d*Z

   Where d denotes a digit, and * is the kleene star.

   XSD datetime also supports negative years, but as we cannot represent
   them with time_t, we can reject it at the lexical level.
2010-06-10 21:26:10 +00:00
Benjamin Dauvergne 2c0ea4d647 Change all logging to use message() 2010-06-09 16:54:55 +00:00
Benjamin Dauvergne aeb27a107c Core: in xml error message handler, escape messages to fit on one line 2010-06-09 16:54:54 +00:00
Benjamin Dauvergne 59d406b8a6 Core: remove arrow in log messages 2010-06-09 16:54:53 +00:00
Frédéric Péters 4c130d779a Add new lasso_log_set_handler and lasso_log_remove_handler functions
They are modeled around the g_log... functions of GLib, they just don't
have a domain parameter.
2010-06-09 07:51:52 +00:00
Benjamin Dauvergne f4130519fc Core: fix extraction of relaystate when URLs contains only one kind of separators 2010-05-31 07:13:46 +00:00
Benjamin Dauvergne a041a2ef81 Initialize all uninitialized rc variables 2010-04-30 09:23:01 +00:00
Benjamin Dauvergne 1ef02e3fe2 Improve safety by replacing all g_string_free use by lasso_release_gstring 2010-04-22 00:44:49 +00:00
Benjamin Dauvergne 0a169eda51 Improve safety by replacing all g_free use by lasso_release 2010-04-22 00:44:45 +00:00
Benjamin Dauvergne 4b9f6d8305 Core: add lasso_set_string_from_prop(char**,xmlNode*,..) function 2010-03-27 16:51:50 +00:00
Benjamin Dauvergne 75598ef566 Core: export lasso_build_unique_id into public API
* lasso/xml/tools.h:
   add new header to export lasso_build_unique_id as a public API.

 * lasso/xml/Makefile.am:
   add tools.h to header list

 * lasso/xml/tools.c:
   add GObjectIntrospection annotations to exported functions.
2010-03-02 11:57:58 +00:00
Benjamin Dauvergne 8598c1327a Core: add a level argument to lasso_xmlnode_to_string and _lasso_node_export_to_xml 2010-03-02 11:57:29 +00:00
Benjamin Dauvergne 46a823ff85 Add lasso_string_to_xsd_integer, to parse xsd:integer values 2010-02-22 13:30:41 +00:00
Benjamin Dauvergne 5d9e6f550a Core: add a lasso_xmlnode_to_string function
* lasso/xml/tools.c lasso/xml/private.h:
   lots of functions duplicate this code, so we factorized it there.
   It has two parameters, the xmlnode and boolean deciding whether to
   format the resulting content (good for reading but bad for
   signatures).
2010-02-17 10:15:24 +00:00
Benjamin Dauvergne 39d4444475 in tools.c, add defines to permit import of timegm 2010-02-17 10:14:44 +00:00
Benjamin Dauvergne b13ddc086b Core: fix lasso_iso_8601_gmt_to_time_t, use timegm instead of mktime
* lasso/xml/tools.c:
   mktime convert works on local time, we need timegm to work with GMT
   time.
2010-02-17 10:14:41 +00:00
Benjamin Dauvergne 7041018303 Core: in lasso_verify_signature, fix conditional about single reference
* lasso/xml/toosl.c:
   verify that reference is unique if NO_SINGLE_REFERENCE is disabled.
2010-02-15 10:37:42 +00:00
Benjamin Dauvergne dad75ee5f1 Fix lasso_get_relaystate_from_query, support semi-colon and parameter at beginning
* lasso/xml/tools.c:
  getting first parameter was broken (query_string does not contain '?'
  at the beginning) and semi-colon support was missing.
2010-02-12 09:48:20 +00:00
Benjamin Dauvergne 6b601b55ee Documentation: complete non finished documentation comments
* too much warnings when generating doc, now we can concentrate on
   undocumented symbols (in
   lasso/docs/reference/lasso/lasso-undocumented.txt).
2010-02-10 13:58:40 +00:00