summaryrefslogtreecommitdiffstats
path: root/lasso
diff options
context:
space:
mode:
authorValery Febvre <vfebvre at easter-eggs.com>2004-08-03 13:54:58 +0000
committerValery Febvre <vfebvre at easter-eggs.com>2004-08-03 13:54:58 +0000
commit03dbde1cf482803bf733e14bb8b7fc94d8342932 (patch)
treeffcae6279e8ed4924c4c74d3cb185c3283f85914 /lasso
parentbbed9c0088c7526bbdc22dae77a261b31ff2e544 (diff)
downloadlasso-03dbde1cf482803bf733e14bb8b7fc94d8342932.tar.gz
lasso-03dbde1cf482803bf733e14bb8b7fc94d8342932.tar.xz
lasso-03dbde1cf482803bf733e14bb8b7fc94d8342932.zip
Fixed a bug in lasso_session_new_from_dump()
Diffstat (limited to 'lasso')
-rw-r--r--lasso/id-ff/session.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/lasso/id-ff/session.c b/lasso/id-ff/session.c
index e92e71f3..b150c9f1 100644
--- a/lasso/id-ff/session.c
+++ b/lasso/id-ff/session.c
@@ -87,25 +87,25 @@ lasso_session_add_assertion(LassoSession *session,
LassoNode *assertion)
{
int i;
- gboolean found;
+ gboolean found = FALSE;
- g_return_val_if_fail(session!=NULL, -1);
- g_return_val_if_fail(remote_providerID!=NULL, -2);
- g_return_val_if_fail(assertion!=NULL, -3);
+ g_return_val_if_fail(session != NULL, -1);
+ g_return_val_if_fail(remote_providerID != NULL, -2);
+ g_return_val_if_fail(assertion != NULL, -3);
/* add the remote provider id */
- found = FALSE;
for(i = 0; i<session->providerIDs->len; i++) {
if(xmlStrEqual(remote_providerID, g_ptr_array_index(session->providerIDs, i))) {
found = TRUE;
+ break;
}
}
if(found == TRUE) {
- message(G_LOG_LEVEL_CRITICAL, "A provider id already exists\n");
- return(-4);
+ message(G_LOG_LEVEL_CRITICAL, "An assertion existed already for this providerID, it was replaced by the new one.\n");
+ }
+ else {
+ g_ptr_array_add(session->providerIDs, g_strdup(remote_providerID));
}
-
- g_ptr_array_add(session->providerIDs, g_strdup(remote_providerID));
/* add the assertion */
g_hash_table_insert(session->assertions, g_strdup(remote_providerID),
@@ -385,7 +385,7 @@ lasso_session_new_from_dump(gchar *dump)
{
LassoSession *session;
LassoNode *session_node;
- LassoNode *assertions_node, *assertion_node;
+ LassoNode *assertions_node, *assertion_node, *assertion;
xmlNodePtr assertions_xmlNode, assertion_xmlNode;
xmlChar *remote_providerID;
GError *err = NULL;
@@ -418,12 +418,23 @@ lasso_session_new_from_dump(gchar *dump)
remote_providerID = lasso_node_get_attr_value(assertion_node,
LASSO_SESSION_REMOTE_PROVIDERID_ATTR,
&err);
- if (remote_providerID == NULL) {
+ if (remote_providerID != NULL) {
+ assertion = lasso_node_get_child(assertion_node,
+ "Assertion", lassoLibHRef,
+ &err);
+ if (assertion != NULL) {
+ lasso_session_add_assertion(session, remote_providerID, assertion);
+ lasso_node_destroy(assertion);
+ }
+ else {
+ message(G_LOG_LEVEL_CRITICAL, err->message);
+ g_clear_error(&err);
+ }
+ }
+ else {
message(G_LOG_LEVEL_CRITICAL, err->message);
- g_error_free(err);
- continue;
+ g_clear_error(&err);
}
- lasso_session_add_assertion(session, remote_providerID, assertion_node);
g_free(remote_providerID);
lasso_node_destroy(assertion_node);
}