Commit Graph

356 Commits

Author SHA1 Message Date
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 192777bac1 Core: use lasso_xmlnode_to_string in LassoNode export functions
* lasso/xml/xml.c:
   remove duplicate codes and use lasso_xmlnode_to_string instead.
2010-02-17 10:15:31 +00:00
Benjamin Dauvergne 62ac1616e4 Core: add error exit to lasso_node_new_from_xmlNode
* lasso/xml/xml.c:
   if building of the node fails, we must keep the initialization of
   custom nodename and namespace.
2010-02-17 10:15:14 +00:00
Benjamin Dauvergne 685a82b7af ID-WSF 2.0: add strings for Discovery service Actions 2010-02-17 10:14:39 +00:00
Benjamin Dauvergne 686951e381 Use defined symbols instead of magic constants 2010-02-12 09:48:23 +00:00
Benjamin Dauvergne 3433a07361 Core: add more memory tracing, add a tracing macro
* lasso/utils.h: add lasso_trace, which as a printf signature.
 * xml/xml.c: add more trace to node initialization code.
2010-02-04 00:02:16 +00:00
Benjamin Dauvergne b780bd2376 Fix leaks
* lasso/id-wsf-2.0/profile.c: release private data object.
 * lasso/saml-2.0/login.c: free NameID content after construction.
 * lasso/xml/tools.c: free algorithm attribute content in
   lasso_node_decrypt_xmlnode.
 * lasso/xml/xml.c: release cutom_element->nodename in destructor.
   remove useless finalize method.
 * tests/basic_tests.c: release xmldoc after use.
 * tests/random_tests.c: free resut of lasso_node_dump.
2010-02-04 00:02:07 +00:00
Benjamin Dauvergne 7aa18e07b1 Fix leaks, change signature of lasso_provider_get_sp_name_qualifier, make it return a const char* 2010-02-04 00:02:05 +00:00
Benjamin Dauvergne 5b8b096341 in lasso_xmlsec_load_private_key, do not leak the file buffer, in lasso_node_encrypt do not leak the keys manager 2010-02-04 00:02:00 +00:00
Benjamin Dauvergne 19b7cc0bbc ID-WSF: change name of Personal Profile namespace symbols, add symbols for ID-SIS PP 1.1 2010-01-28 15:31:52 +00:00
Benjamin Dauvergne 7d786e27bf Core XML: make lasso_node_set_custom_namespace/nodename take const string
* lasso/xml/xml.c lasso/xml/xml.h:
   mark argument of lasso_node_set_custom_namespace and
   lasso_node_set_custom_nodename as const char* strings.
2010-01-26 20:59:24 +00:00
Benjamin Dauvergne ce42be1481 Core XML: add function to get the namespace of a LassoNode
* lasso/xml/xml.c lasso/xml/xml.h:
   if a custome namespace is set, return it, otherwise return the class
   namespace (klass->node_data->ns->href).
2010-01-26 20:59:22 +00:00
Benjamin Dauvergne bec8672cc5 Add new macro lasso_list_add_new_xml_node
* lasso/utils.h:
   fix lasso_list_add_xml_node, it must copy the node before assigning
   it.
   add lasso_list_add_new_xml_node for keeping the old behaviour.
 * lasso/xml/xml.c:
   fix use of lasso_list_add_xml_node, because copying the node before
   assigning it is a leak now.
2010-01-25 23:47:43 +00:00
Benjamin Dauvergne 0279087029 Documentation: distribute stylesheet, fix documentation comments, compelte lasso-sections.txt 2010-01-18 10:03:54 +00:00
Benjamin Dauvergne 5ac1c303cc Commit to delete 2010-01-12 15:40:03 +00:00
Benjamin Dauvergne d42c16e239 Core Node: add args to lasso_node_encrypt to set recipient of an encrypted element 2010-01-12 15:39:57 +00:00
Benjamin Dauvergne ac3a687518 XML Core: in xml.c, private.h, add a lasso_node_remove_signature function 2010-01-12 15:39:42 +00:00
Benjamin Dauvergne 7e22acdd2c Core XML: in xml.{c,h}, add new function lasso_node_get_name to get the element name for an object 2010-01-04 09:13:59 +00:00
Benjamin Dauvergne 4a10bbf9c6 Core XML: in xml.c, keep original node names, handle xsi:type attribute better
* lasso/xml/xml.c lasso/xml/xml.h:
   - fix signature of lasso_node_set_original_xmlnode, fix signature in
     documentation of lasso_node_set_original_xmlnode;
   - add a new API lasso_node_set_custom_nodename to specify the exact
     element name to use when serializing a LassoNode to XML.
   - rename internal structure _CustomNamespace to _CustomElement, add a
     nodename field to it.
   - rework internal functions around _CustomElement to be aware of an
     existing attached _CustomElement and re-use if needed.
   - move application of _CustomElement hints after the serialization of
     the node, so that the normal behaviour of the serialization is kept
     -- i.e. do not play with the list of parent classes.

   - use the full xsi:type content to find a LassoNode subclass when
     de-serializaing XML content, factorize QName->GObject class mapping
     for the three executions paths inside
     _type_name_from_href_and_nodename:
      - element QName,
      - xsi:type QName,
      - element name with xsi:type namespace
   - add a long comment expliciting the way the mapping is done.
   - remove direct mapping of EncryptedAssertion element, the registry
     declaration on the class LassoSaml2EncryptedElement shoud be
     enough.
2010-01-04 09:13:53 +00:00
Benjamin Dauvergne 3feefb47de Core XML: in xml.c, parse attributes with namespace checking
* lasso/xml/xml.c:
   - use snippet->ns_uri and snippet->ns_name to parse attributes
     outside of the parent node namespace.
2010-01-04 09:13:51 +00:00
Benjamin Dauvergne 72eac3fd19 Fix reporting of error in message parsing
* lasso/xml/xml.c:
   do not mix the return code from xmlSecBase64Decode and the return
   code for lasso_node_init_from_message_with_format.
   It fixes a segmentation fault in
   lasso_login_process_authn_request_msg.
2009-10-30 14:47:37 +00:00
Benjamin Dauvergne c462bc3b2a Do not use g_new, use g_new0
* lasso/id-ff/federation.c:
 * lasso/id-ff/logout.c:
 * lasso/id-ff/profile.c:
 * lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
 * lasso/id-ff/session.c:
 * lasso/id-wsf/authentication.c:
 * lasso/saml-2.0/ecp.c:
 * lasso/xml/xml.c:
   even for private datas, use g_new0, it is safer.
2009-09-29 13:20:36 +00:00
Benjamin Dauvergne 77a1233080 Fix bugs found via coverity (thanks to Bhaskar Jain)
* lasso/id-wsf-2.0/data_service.c: fix uninitialized res variable in
   lasso_idwsf2_data_service_process_query_response_soap_fault_msg.
 * lasso/xml/saml-2.0/saml2_assertion.c: fix uninitialized rc variable
   in get_xmlNode.
 * lasso/saml-2.0/login.c:
   in lasso_saml20_login_accept_sso check for ni and ni->Format
   null-ness before dereferencing, remove idp_ni which is not used
   anymore.
   remote all use of federation->remote_nameIdentifier, SAML 2.0 only
   need one NameID, and it will be local_nameIdentifier.
 * lasso/xml/xml.c:
   in lasso_node_traversal, check null-ness of node before dereferencing
   it, add check for class null-ness also.
 * lasso/id-ff/provider.c:
   in lasso_provider_get_first_http_method, remove useless check for t2
   null-ness -- if found is TRUE, t1 and t2 cannot be null.
 * lasso/xml/tools.c:
   in lasso_sign_node, add documentation, check for private_key_file and
   xmlnode null-ness.
   in lasso_get_public_key_from_private_key_file, add a cleanup phase,
   check for cert variabl null-ness befor appending, count the number of
   certificates added.
   in lasso_query_verify_signature, check that URL unescaping and base64
   decoding are succesfull before using the decoded strings.
 * lasso/saml-2.0/name_id_management.c:
   in lasso_name_id_management_validate_request, fix mis-handling of
   federation, if federation does not match request name_id, return
   UNKNOWN_PRINCIPAL.
2009-09-17 15:05:50 +00:00
Benjamin Dauvergne 550678afe9 XML ID-WSF: Fix parsing of most ID-WSF elements
* lasso/xml/disco_send_single_logout.c:
 * lasso/xml/id-wsf-2.0/sb2_user_interaction_header.c:
 * lasso/xml/id-wsf-2.0/subsref_app_data.c:
 * lasso/xml/xml.c:
   lots of ID-WSF 1.0/2.0 classes were not passing the new
   non-regression test on serialization/deserialization.
   The main reason was the absence of mapping for their namespace in the
   prefix_from_href_and_nodename function. The other reason is that some
   class name does not correspond 1-to-1 to the element name
   (SendSingleLogOut vs. SendSingleLogout, notice the capitalised 'O').

   The last problem was that mapping from nodes to GObject classes was
   done after default mapping ("Lasso<prefix><node_name>"), now it's
   done before, to reflect the fact that it is a more specialized
   mapping.
2009-09-11 15:51:57 +00:00
Benjamin Dauvergne 1f78831973 XML: Fix seg-fault bug introduced in commit 4108
* lasso/xml/xml.c:
   lasso_node_get_xmlnode_for_any_type is broken, if no original_xmlnode
   is present, return just cur. Also add all missing cases for the state
   of the pair (cur, orignal_xmlnode).
 * tests/basic_tests.c:
   add a non-regression test, testing all dump/restore functions.
2009-09-11 15:51:53 +00:00
Benjamin Dauvergne b6abc9895e ID-WSF: remove LassoWsseSecurity in favor of LasoWsSec1SecurityHeader
* xml/Makefile.am:
   remove the file from the source list
 * xml/wsse_security.c:
 * xml/wsse_security.h:
   remove the files
 * xml/xml.c:
   use LassoWsSec1SecurityHeader for LASSO_WSSE_HREF namespace also.
2009-09-11 15:51:36 +00:00
Benjamin Dauvergne 8a7c0cbaa3 XML: add an API to set namespace on a single instance of a LassoNode
* lasso/xml/xml.h lasso/xml/xml.c:
   add a new public API lasso_node_set_custom_namespace(node, prefix,
   href). It allows to set the precise namespace of a single object, all
   other instance of the same class continue to use the default
   namespace for the class.
   It should be used for difficult consumer of certain nodes (like
   wsse:Security) which only know certain namespace or do not use the
   namespace going with the specified version of a specification (like
   MSP not following ID-WSF 1.0 specification and using
   http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
   instead of
   http://schemas.xmlsoap.org/ws/2003/06/secext.
   It also allows to share implementation of schema objects common to
   many version of the same specification (wsse:Security between ID-WSF
   1.0 and ID-WSF 2.0), without creating too many child classes.
2009-09-11 15:51:32 +00:00
Benjamin Dauvergne 7231771856 All: Rework include files handling, separated ID-WSF code from SAML2/ID-FF code
* nearly all C files: change includes for relative paths.
 * lasso/id-wsf/id_wsf.h, lasso/id-wsf-2.0/id_wsf_2.h: add top level
   public include files for ID-WSF 1.0 and ID-WSF 2.0.
 * lasso/id-ff/server.*, lasso/id-ff/session.*, lasso/id-ff/identity.*:
   remove most of the code related to ID-WSF and push into
   lasso/id-wsf/id_ff_extensions.* and lasso/id-wsf-2.0/identity.c,
   lasso/id-wsf-2.0/server.c, lasso/id-wsf-2.0/session.c.
 * lasso/id-wsf-2.0/saml2_login.c,
   lasso/id-wsf-2.0/saml2_login_private.h: same change but for ID-WSF
   2.0 support in SAML2 SSO profile.
2009-08-26 15:14:32 +00:00
Benjamin Dauvergne e57e1efc21 LassoNode: Fix leaks
* lasso/xml/xml.c:
   fix more and more leaks.
2009-04-30 14:58:09 +00:00
Benjamin Dauvergne a74bd368d4 Add debugging code to lasso_node_impl_init_from_xml
* lasso/xml/xml.c:
   add more debugging code for the memory-debug flag.
2009-04-30 14:58:08 +00:00
Benjamin Dauvergne 00c83baf38 Add debugging code to lasso_set_orginal_xmlnode
* lasso/xml/xml.c:
   add code to trace allocation and deallocation of original xmlnode
   associated to LassoNodes.
2009-04-30 14:58:06 +00:00
Benjamin Dauvergne 52e60ecb09 Rework cleanup handling
* lasso/utils.h:
   change 'goto exit' for 'goto cleanup'. rename all goto_exit macros to
   goto_cleanup_.  rename goto_cleanup_if_fail to
   goto_cleanup_if_fail_with_rc and add a
   goto_cleanup_if_fail for function which do not return an integer
   value. add documentation for goto_cleanup macro family.
 * lasso/id-ff/login.c:
 * lasso/id-ff/provider.c:
 * lasso/id-ff/server.c:
 * lasso/id-ff/session.c:
 * lasso/id-wsf/discovery.c:
 * lasso/id-wsf/wsf_profile.c:
 * lasso/saml-2.0/profile.c:
 * lasso/utils.h:
 * lasso/xml/lib_logout_request.c:
 * lasso/xml/tools.c:
 * lasso/xml/xml.c:
   update name of goto_exit_if_fail macros. rename 'exit' labels to
   'cleanup'.
2009-04-22 23:49:29 +00:00
Benjamin Dauvergne ce3c049c7c XML: Fix prefix clobbering by xsi:type handling
* lasso/xml/xml.c:
   if xsi:type is not able to find a GObject typename for the current
   node, then do not erase the actual prefix value. change prefix type
   to const char.
2009-04-22 23:49:25 +00:00
Benjamin Dauvergne 670383da1e If no typename could be determined, stop parsing.
* lasso/xml/xml.c:
   in lasso_node_new_from_xmlNode if no typename is found for the given
   xmlNode, return NULL.
2009-04-21 12:22:41 +00:00
Benjamin Dauvergne dac53715ea Core: Add cast to first argument of isalnum
* lasso/xml/xml.c:
 * lasso/xml/tools.c:
   isalnum takes a int as first arg.
2009-04-14 07:51:25 +00:00
Benjamin Dauvergne 075c9a1a93 XML: use macro for assignment
* lasso/xml/xml.c: use standardized assignment macros (it takes care of
   releasing previous valuesm and other peculiarities associated with
   safe pointer usage).
2009-03-27 15:06:38 +00:00
Benjamin Dauvergne 60018bbb4d XML: fix memory leaks
* lasso/xml/tools.c:
 * lasso/xml/xml.c:
   release xmlDoc, properly steal nodes by using xmlSetTreeDoc(xmlnode, NULL);
2009-03-27 15:06:30 +00:00
Benjamin Dauvergne 8100385979 XML: Remove useless parsing of RelayState in lasso_node_init_from_saml2_query_fields
* lasso/xml/xml.c: (lasso_node_init_from_saml2_query_fields) Since parsing
    of the relayState is now done inside each "_process_*msg" method of
    each SAML2 profile, it is not needed anymore in this function.
2009-03-27 15:06:06 +00:00
Benjamin Dauvergne 27ac758de6 XML: Use memory macros inside lasso_node_export_to_query
* lasso/xml/xml.c (lasso_node_export_to_query): use lasso own memory
   handling macros.
2009-03-27 15:06:03 +00:00
Benjamin Dauvergne 63b38a4066 ID-FF 1.2: review HTTP-Redirect binding parsing/building
* lasso/xml/lib_authn_request.c, lasso/xml/lib_logout_request.c,
   lasso/xml/lib_register_name_identifier_request.c,
   lasso/xml/lib_status_resposne.c:
   - build_query: remove build_query overloaded virtual method, use
     LassoNode new generic implementation.
   - init_from_query:
     - change direct call to lasso_node_init_from_query_fields to use of
       base implementation from LassoNode.
     - make use of utils.h memory handling macros like
       lasso_release_gobject and lasso_assign_string.

 * lasso/xml/lib_federation_termination_notification.c:
   - init_from_query: remove parsing of RelayState parameter
2009-03-27 15:05:59 +00:00
Benjamin Dauvergne f604d63268 XML: Remove static modifier on lasso_node_build_query
* lasso/xml/private.h, lasso/xml/xml.c: remove static modifier to
   lasso_node_build_query and export it for use in id-ff profiles.
2009-03-27 15:05:41 +00:00
Benjamin Dauvergne d0d71abe2c Core: rename lasso_release_xmlchar to lasso_release_xml_string
* lasso/id-wsf/wsf_profile.c, lasso/utils.h, lasso/xml/xml.c: rename
   lasso_release_xmlchar to lasso_release_xml_string.
2009-03-27 15:05:37 +00:00
Benjamin Dauvergne c9011fb16b Core: replace direct use of xmlSecSoap function by wrapper
* lasso/xml/xml.c:
   In lasso_node_init_from_message_with_format remove direct use of
   xmlSecSoap* functions because they emit too much warning by lasso
   reimplementations.
2009-03-27 15:05:31 +00:00
Benjamin Dauvergne f6f8ffcd6e Core: remove use of XPath
* lasso/xml/xml.c:
   in lasso_node_new_from_soap, instead of using XPath use function
   lasso_xml_get_soap_content.
2009-03-27 15:05:29 +00:00
Benjamin Dauvergne dd9382d05b Core: fix comment for lasso_node_init_from_message
* lasso/xml/xml.c:
   state the return code type.
2009-03-27 15:05:28 +00:00
Benjamin Dauvergne c252e5d1c3 Core: remove lasso_node_decrypt implementation
* lasso/xml/xml.c:
   remove code for lasso_node_decrypt.
2009-03-27 15:05:26 +00:00
Benjamin Dauvergne 8fc5cb3f49 Core: make comment agree with the code
* lasso/xml/xml.c:
   change comment about xsi:type handling, we try to honor every
   xsi:type.
2009-03-27 15:05:24 +00:00
Benjamin Dauvergne d8aa0d69a0 Core: remove commented code
* lasso/xml/xml.c:
   remove commented code to handle a specific lasso extension.
2009-03-27 15:05:23 +00:00
Benjamin Dauvergne 642dcfdfbb Core: use lasso_xml_parse_memory instead of xmlParseDoc
* lasso/id-ff/provider.c:
   use internal wrapper instead of direct call to libxml for parsing.
2009-03-27 15:05:21 +00:00
Benjamin Dauvergne 580239d233 Core: move parse xml wrapper from xml.c to tools.c
* lasso/xml/xml.c:
   remove lasso_xml_parse_memory.
 * lasso/xml/tools.c:
   add lasso_xml_parse_memory to wrap xmlParseDocument.
 * lasso/saml-2.0/name_id_management.c:
   use lasso_xml_parse_memory
2009-03-27 15:05:19 +00:00