summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Clapies <nclapies@entrouvert.com>2004-07-16 13:29:23 +0000
committerNicolas Clapies <nclapies@entrouvert.com>2004-07-16 13:29:23 +0000
commit3827d324bb20ab60b7a39537fd3b768c9bef4c73 (patch)
tree669eb0790b1f4c011516d3871fcb7edf4ce5b194
parent0438887aa3feef58aa8c0cc574b16f5999f4c9cd (diff)
downloadlasso-3827d324bb20ab60b7a39537fd3b768c9bef4c73.tar.gz
lasso-3827d324bb20ab60b7a39537fd3b768c9bef4c73.tar.xz
lasso-3827d324bb20ab60b7a39537fd3b768c9bef4c73.zip
*** empty log message ***
-rw-r--r--lasso/id-ff/user.c20
-rw-r--r--python/environs/py_user.c4
2 files changed, 18 insertions, 6 deletions
diff --git a/lasso/id-ff/user.c b/lasso/id-ff/user.c
index ad5d8376..711d15a5 100644
--- a/lasso/id-ff/user.c
+++ b/lasso/id-ff/user.c
@@ -54,12 +54,16 @@ lasso_user_add_assertion(LassoUser *user,
if(xmlStrEqual(remote_providerID, g_ptr_array_index(user->assertion_providerIDs, i)))
found = TRUE;
}
- if(found==FALSE){
- g_ptr_array_add(user->assertion_providerIDs, g_strdup(remote_providerID));
+ if(found==TRUE){
+ debug(ERROR, "A provider id already exists\n");
+ return(-4);
}
+ debug(DEBUG, "add provider id %s\n", remote_providerID);
+ g_ptr_array_add(user->assertion_providerIDs, g_strdup(remote_providerID));
+
/* add the assertion */
- debug(DEBUG, "add an assertion for %s\n", remote_providerID);
+ debug(DEBUG, "Add an assertion for %s\n", remote_providerID);
g_hash_table_insert(user->assertions, g_strdup(remote_providerID), assertion);
return(0);
@@ -160,19 +164,22 @@ lasso_user_get_assertion(LassoUser *user,
{
g_return_val_if_fail(user!=NULL, NULL);
g_return_val_if_fail(remote_providerID!=NULL, NULL);
-
return(g_hash_table_lookup(user->assertions, remote_providerID));
}
gchar*
lasso_user_get_next_providerID(LassoUser *user)
{
+ gchar *remote_providerID;
+
g_return_val_if_fail(user!=NULL, NULL);
if(user->assertion_providerIDs->len==0)
return(NULL);
- return(g_ptr_array_index(user->assertion_providerIDs, 0));
+ remote_providerID = g_strdup(g_ptr_array_index(user->assertion_providerIDs, 0));
+
+ return(remote_providerID);
}
LassoIdentity*
@@ -201,8 +208,9 @@ lasso_user_remove_assertion(LassoUser *user,
/* remove the remote provider id */
for(i = 0; i<user->assertion_providerIDs->len; i++){
+ printf("%s %s\n", remote_providerID, g_ptr_array_index(user->assertion_providerIDs, i));
if(xmlStrEqual(remote_providerID, g_ptr_array_index(user->assertion_providerIDs, i))){
- debug(INFO, "Remove assertion for %s\n", remote_providerID);
+ debug(DEBUG, "Remove assertion of %s\n", remote_providerID);
g_ptr_array_remove_index(user->assertion_providerIDs, i);
break;
}
diff --git a/python/environs/py_user.c b/python/environs/py_user.c
index 5de637a9..5f219074 100644
--- a/python/environs/py_user.c
+++ b/python/environs/py_user.c
@@ -120,6 +120,10 @@ PyObject *user_get_next_providerID(PyObject *self, PyObject *args) {
else return NULL;
remote_providerID = lasso_user_get_next_providerID(LassoUser_get(user_obj));
+ if(remote_providerID==NULL){
+ Py_INCREF(Py_None);
+ return (Py_None);
+ }
return (charPtr_wrap(remote_providerID));
}