summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-04-08 08:47:08 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-04-08 08:51:36 (GMT)
commit6512c4cbfbfb1d6347308a3d05db3834422da6e5 (patch)
tree0905d066b670e9b03b17c5b6dba24d36264da8ef
parent4b4c63e97e57949ee9f1bc0a7e6f08aad6d903ff (diff)
downloadmodmellon-6512c4cbfbfb1d6347308a3d05db3834422da6e5.zip
modmellon-6512c4cbfbfb1d6347308a3d05db3834422da6e5.tar.gz
modmellon-6512c4cbfbfb1d6347308a3d05db3834422da6e5.tar.bz2
Use lasso_node_dump() on all MiscTextNode value to build attribut values
AttributeValue nodes can contain an unlimited list of node or LassoMiscTextNode objects.
-rw-r--r--auth_mellon_handler.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/auth_mellon_handler.c b/auth_mellon_handler.c
index 242530f..c1c8975 100644
--- a/auth_mellon_handler.c
+++ b/auth_mellon_handler.c
@@ -1592,7 +1592,9 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r,
LassoSaml2Attribute *attribute;
GList *value_itr;
LassoSaml2AttributeValue *value;
- LassoMiscTextNode *value_text;
+ GList *any_itr;
+ char *content;
+ char *dump;
int ret;
dir_cfg = am_get_dir_cfg(r);
@@ -1649,6 +1651,7 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r,
value_itr != NULL;
value_itr = g_list_next(value_itr)) {
+
value = value_itr->data;
if (!LASSO_IS_SAML2_ATTRIBUTE_VALUE(value)) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
@@ -1667,20 +1670,29 @@ static int add_attributes(am_cache_entry_t *session, request_rec *r,
continue;
}
- /* Verify that this is a LassoMiscTextNode object. */
- if(!LASSO_IS_MISC_TEXT_NODE(value->any->data)) {
- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
- "AttributeValue element contained an "
- " element which wasn't a text node.");
- continue;
+ content = "";
+ for (any_itr = g_list_first(value->any);
+ any_itr != NULL;
+ any_itr = g_list_next(any_itr)) {
+ /* Verify that this is a LassoNode object. */
+ if(!LASSO_NODE(any_itr->data)) {
+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+ "AttributeValue element contained an "
+ " element which wasn't a Node.");
+ continue;
+ }
+ dump = lasso_node_dump(LASSO_NODE(any_itr->data));
+ if (!dump) {
+ ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+ "AttributeValue content dump failed.");
+ continue;
+ }
+ /* Use the request pool, no need to free results */
+ content = apr_pstrcat(r->pool, content, dump, NULL);
+ g_free(dump);
}
-
- value_text = LASSO_MISC_TEXT_NODE(value->any->data);
-
-
/* Decode and save the attribute. */
- ret = am_store_attribute(r, session, attribute->Name,
- value_text->content);
+ ret = am_store_attribute(r, session, attribute->Name, content);
if(ret != OK) {
return ret;
}