summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2006-12-27 23:50:15 +0000
committerFrederic Peters <fpeters@entrouvert.com>2006-12-27 23:50:15 +0000
commit08088875482304db5e3b80e68743799657fe6361 (patch)
tree77f15bf6bdb851bd26a2d55f3b9ea2a29aaa7f44
parentbe476b2af6dc89151e16a9ffc69d0fbe0075b6ea (diff)
downloadlasso-08088875482304db5e3b80e68743799657fe6361.tar.gz
lasso-08088875482304db5e3b80e68743799657fe6361.tar.xz
lasso-08088875482304db5e3b80e68743799657fe6361.zip
fixed all occurences of returning a negative number unspecified in errors.h
-rw-r--r--lasso/id-ff/identity.c4
-rw-r--r--lasso/id-ff/lecp.c18
-rw-r--r--lasso/id-ff/login.c6
-rw-r--r--lasso/id-ff/logout.c6
-rw-r--r--lasso/id-ff/name_identifier_mapping.c6
-rw-r--r--lasso/id-ff/name_registration.c25
-rw-r--r--lasso/id-ff/session.c26
-rw-r--r--lasso/id-wsf/data_service.c4
-rw-r--r--lasso/saml-2.0/name_id_management.c8
9 files changed, 55 insertions, 48 deletions
diff --git a/lasso/id-ff/identity.c b/lasso/id-ff/identity.c
index f06da677..89531c07 100644
--- a/lasso/id-ff/identity.c
+++ b/lasso/id-ff/identity.c
@@ -50,8 +50,8 @@ struct _LassoIdentityPrivate
gint
lasso_identity_add_federation(LassoIdentity *identity, LassoFederation *federation)
{
- g_return_val_if_fail(LASSO_IS_IDENTITY(identity), -1);
- g_return_val_if_fail(LASSO_IS_FEDERATION(federation), -3);
+ g_return_val_if_fail(LASSO_IS_IDENTITY(identity), LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(LASSO_IS_FEDERATION(federation), LASSO_PARAM_ERROR_INVALID_VALUE);
/* add the federation, replace if one already exists */
g_hash_table_insert(identity->federations,
diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c
index 974b0493..014811fe 100644
--- a/lasso/id-ff/lecp.c
+++ b/lasso/id-ff/lecp.c
@@ -50,7 +50,7 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp)
xmlOutputBuffer *buf;
xmlCharEncodingHandler *handler;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(lecp);
@@ -114,7 +114,7 @@ lasso_lecp_build_authn_request_msg(LassoLecp *lecp)
LassoProfile *profile;
LassoProvider *remote_provider;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(lecp);
@@ -151,7 +151,7 @@ lasso_lecp_build_authn_response_msg(LassoLecp *lecp)
{
LassoProfile *profile;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(lecp);
profile->msg_url = g_strdup(lecp->assertionConsumerServiceURL);
@@ -183,7 +183,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp)
LassoProvider *provider;
gchar *assertionConsumerServiceURL;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(lecp);
@@ -244,7 +244,7 @@ lasso_lecp_init_authn_request(LassoLecp *lecp, const char *remote_providerID)
{
gint res;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
/* FIXME : BAD usage of http_method
using POST method so that the lib:AuthnRequest is initialize with
@@ -269,8 +269,8 @@ lasso_lecp_init_authn_request(LassoLecp *lecp, const char *remote_providerID)
int
lasso_lecp_process_authn_request_msg(LassoLecp *lecp, const char *authn_request_msg)
{
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
- g_return_val_if_fail(authn_request_msg != NULL, -1);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(authn_request_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
return lasso_login_process_authn_request_msg(LASSO_LOGIN(lecp), authn_request_msg);
}
@@ -353,8 +353,8 @@ lasso_lecp_process_authn_response_envelope_msg(LassoLecp *lecp, const char *resp
LassoProfile *profile;
LassoMessageFormat format;
- g_return_val_if_fail(LASSO_IS_LECP(lecp), -1);
- g_return_val_if_fail(response_msg!=NULL, -2);
+ g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(response_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(lecp);
diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c
index 4b27a8f6..2bbd2e56 100644
--- a/lasso/id-ff/login.c
+++ b/lasso/id-ff/login.c
@@ -901,9 +901,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
lareq = lasso_node_export_to_base64(profile->request);
if (lareq == NULL) {
- message(G_LOG_LEVEL_CRITICAL,
- "Failed to export AuthnRequest (Base64 encoded).");
- return -5;
+ return critical_error(LASSO_PROFILE_ERROR_BUILDING_QUERY_FAILED);
}
profile->msg_url = lasso_provider_get_metadata_one(
@@ -1050,7 +1048,7 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID)
LassoProfile *profile;
gint ret = 0;
- g_return_val_if_fail(LASSO_IS_LOGIN(login), -1);
+ g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
IF_SAML2(profile) {
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
index 05775095..8aeb467a 100644
--- a/lasso/id-ff/logout.c
+++ b/lasso/id-ff/logout.c
@@ -487,8 +487,8 @@ lasso_logout_process_request_msg(LassoLogout *logout, char *request_msg)
LassoProvider *remote_provider;
LassoMessageFormat format;
- g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
- g_return_val_if_fail(request_msg != NULL, -1);
+ g_return_val_if_fail(LASSO_IS_LOGOUT(logout), LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(request_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(logout);
@@ -742,7 +742,7 @@ lasso_logout_process_response_msg(LassoLogout *logout, gchar *response_msg)
**/
gint lasso_logout_reset_providerID_index(LassoLogout *logout)
{
- g_return_val_if_fail(LASSO_IS_LOGOUT(logout), -1);
+ g_return_val_if_fail(LASSO_IS_LOGOUT(logout), LASSO_PARAM_ERROR_INVALID_VALUE);
lasso_session_init_provider_ids(LASSO_PROFILE(logout)->session);
logout->providerID_index = 0;
return 0;
diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c
index c9da63a7..25563daa 100644
--- a/lasso/id-ff/name_identifier_mapping.c
+++ b/lasso/id-ff/name_identifier_mapping.c
@@ -57,7 +57,8 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
LassoProfile *profile;
LassoProvider *remote_provider;
- g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(mapping);
@@ -126,7 +127,8 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
LassoProfile *profile;
LassoProvider *remote_provider;
- g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_IDENTIFIER_MAPPING(mapping),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(mapping);
diff --git a/lasso/id-ff/name_registration.c b/lasso/id-ff/name_registration.c
index 8d7dc9b1..ec145a12 100644
--- a/lasso/id-ff/name_registration.c
+++ b/lasso/id-ff/name_registration.c
@@ -61,7 +61,8 @@ lasso_name_registration_build_request_msg(LassoNameRegistration *name_registrati
LassoProvider *remote_provider;
char *url, *query;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
@@ -147,7 +148,8 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
LassoProvider *remote_provider;
char *url, *query;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
@@ -232,8 +234,9 @@ lasso_name_registration_init_request(LassoNameRegistration *name_registration,
LassoFederation *federation;
LassoSamlNameIdentifier *spNameIdentifier, *idpNameIdentifier, *oldNameIdentifier = NULL;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
- g_return_val_if_fail(remote_providerID != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(remote_providerID != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
@@ -370,8 +373,10 @@ gint lasso_name_registration_process_request_msg(LassoNameRegistration *name_reg
LassoSamlNameIdentifier *nameIdentifier;
LassoLibRegisterNameIdentifierRequest *request;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
- g_return_val_if_fail(request_msg != NULL, -1);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(request_msg != NULL,
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
@@ -444,8 +449,9 @@ lasso_name_registration_process_response_msg(LassoNameRegistration *name_registr
int rc;
char *statusCodeValue;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
- g_return_val_if_fail(response_msg != NULL, -1);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(response_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
@@ -538,7 +544,8 @@ lasso_name_registration_validate_request(LassoNameRegistration *name_registratio
LassoLibRegisterNameIdentifierRequest *request;
LassoSamlNameIdentifier *providedNameIdentifier = NULL;
- g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_REGISTRATION(name_registration),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
diff --git a/lasso/id-ff/session.c b/lasso/id-ff/session.c
index 3e097687..db85d9cc 100644
--- a/lasso/id-ff/session.c
+++ b/lasso/id-ff/session.c
@@ -49,9 +49,9 @@ struct _LassoSessionPrivate
gint
lasso_session_add_assertion(LassoSession *session, char *providerID, LassoNode *assertion)
{
- g_return_val_if_fail(session != NULL, -1);
- g_return_val_if_fail(providerID != NULL, -2);
- g_return_val_if_fail(assertion != NULL, -3);
+ g_return_val_if_fail(session != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(providerID != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(assertion != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
g_hash_table_insert(session->assertions, g_strdup(providerID), assertion);
@@ -73,9 +73,9 @@ lasso_session_add_assertion(LassoSession *session, char *providerID, LassoNode *
gint
lasso_session_add_status(LassoSession *session, char *providerID, LassoNode *status)
{
- g_return_val_if_fail(session != NULL, -1);
- g_return_val_if_fail(providerID != NULL, -2);
- g_return_val_if_fail(status != NULL, -3);
+ g_return_val_if_fail(session != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(providerID != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(status != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
g_hash_table_insert(session->private_data->status, g_strdup(providerID), status);
@@ -258,16 +258,15 @@ lasso_session_is_empty(LassoSession *session)
gint
lasso_session_remove_assertion(LassoSession *session, gchar *providerID)
{
- if (session == NULL) {
- return LASSO_ERROR_UNDEFINED;
- }
+ g_return_val_if_fail(session != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(providerID != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
if (g_hash_table_remove(session->assertions, providerID)) {
session->is_dirty = TRUE;
return 0;
}
- return LASSO_ERROR_UNDEFINED; /* assertion not found */
+ return LASSO_PROFILE_ERROR_MISSING_ASSERTION;
}
/**
@@ -282,16 +281,15 @@ lasso_session_remove_assertion(LassoSession *session, gchar *providerID)
gint
lasso_session_remove_status(LassoSession *session, gchar *providerID)
{
- if (session == NULL) {
- return LASSO_ERROR_UNDEFINED;
- }
+ g_return_val_if_fail(session != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(providerID != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
if (g_hash_table_remove(session->private_data->status, providerID)) {
session->is_dirty = TRUE;
return 0;
}
- return LASSO_ERROR_UNDEFINED; /* status not found */
+ return LASSO_PROFILE_ERROR_MISSING_STATUS_CODE;
}
/*****************************************************************************/
diff --git a/lasso/id-wsf/data_service.c b/lasso/id-wsf/data_service.c
index 90615288..d89ec8e2 100644
--- a/lasso/id-wsf/data_service.c
+++ b/lasso/id-wsf/data_service.c
@@ -729,8 +729,8 @@ lasso_data_service_process_modify_response_msg(LassoDataService *service, const
LassoDstModifyResponse *response;
LassoSoapEnvelope *envelope;
- g_return_val_if_fail(LASSO_IS_PROFILE_SERVICE(service), -1);
- g_return_val_if_fail(soap_msg != NULL, -1);
+ g_return_val_if_fail(LASSO_IS_PROFILE_SERVICE(service), LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(soap_msg != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
envelope = LASSO_SOAP_ENVELOPE(lasso_node_new_from_dump(soap_msg));
LASSO_WSF_PROFILE(service)->soap_envelope_response = envelope;
diff --git a/lasso/saml-2.0/name_id_management.c b/lasso/saml-2.0/name_id_management.c
index a8aa9c68..9e5862c6 100644
--- a/lasso/saml-2.0/name_id_management.c
+++ b/lasso/saml-2.0/name_id_management.c
@@ -58,8 +58,9 @@ lasso_name_id_management_init_request(LassoNameIdManagement *name_id_management,
LassoSaml2NameID *name_id, *name_id_n;
LassoSamlp2RequestAbstract *request;
- g_return_val_if_fail(LASSO_IS_NAME_ID_MANAGEMENT(name_id_management), -1);
- g_return_val_if_fail(remote_provider_id != NULL, LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
+ g_return_val_if_fail(LASSO_IS_NAME_ID_MANAGEMENT(name_id_management),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
+ g_return_val_if_fail(remote_provider_id != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_id_management);
@@ -136,7 +137,8 @@ lasso_name_id_management_build_request_msg(LassoNameIdManagement *name_id_manage
LassoProfile *profile;
LassoProvider *remote_provider;
- g_return_val_if_fail(LASSO_IS_NAME_ID_MANAGEMENT(name_id_management), -1);
+ g_return_val_if_fail(LASSO_IS_NAME_ID_MANAGEMENT(name_id_management),
+ LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_id_management);