summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-12-14 21:41:57 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-12-14 21:41:57 +0000
commit4fe9f93dfae3c2327b6749f7c271eeae321f8647 (patch)
treea1641db42e24a3b41ca92e69c8402c37cbd98727
parent34e10f1d7f3ac2b1118b168fe092272dd806c878 (diff)
downloadlasso-4fe9f93dfae3c2327b6749f7c271eeae321f8647.tar.gz
lasso-4fe9f93dfae3c2327b6749f7c271eeae321f8647.tar.xz
lasso-4fe9f93dfae3c2327b6749f7c271eeae321f8647.zip
new LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL profile error and replaced a bunch
of 'return -1;' with that one.
-rw-r--r--lasso/id-ff/defederation.c17
-rw-r--r--lasso/id-ff/lecp.c6
-rw-r--r--lasso/id-ff/login.c5
-rw-r--r--lasso/id-ff/logout.c8
-rw-r--r--lasso/id-ff/name_identifier_mapping.c3
-rw-r--r--lasso/id-ff/name_registration.c6
-rw-r--r--lasso/xml/errors.c2
-rw-r--r--lasso/xml/errors.h1
8 files changed, 25 insertions, 23 deletions
diff --git a/lasso/id-ff/defederation.c b/lasso/id-ff/defederation.c
index 70720326..1ff5a854 100644
--- a/lasso/id-ff/defederation.c
+++ b/lasso/id-ff/defederation.c
@@ -79,15 +79,17 @@ lasso_defederation_build_notification_msg(LassoDefederation *defederation)
remote_provider, "SoapEndpoint");
profile->msg_body = lasso_node_export_to_soap(profile->request,
profile->server->private_key, profile->server->certificate);
+
+ return 0;
}
+
if (profile->http_request_method == LASSO_HTTP_METHOD_REDIRECT) {
/* build and optionaly sign the query message and build the
* federation termination notification url */
url = lasso_provider_get_metadata_one(remote_provider,
"FederationTerminationServiceURL");
if (url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Unknown profile service URL");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
query = lasso_node_export_to_query(profile->request,
profile->server->signature_method,
@@ -100,16 +102,14 @@ lasso_defederation_build_notification_msg(LassoDefederation *defederation)
}
profile->msg_url = g_strdup_printf("%s?%s", url, query);
+ profile->msg_body = NULL;
g_free(url);
g_free(query);
- profile->msg_body = NULL;
- }
- if (profile->msg_url == NULL) {
- return critical_error(LASSO_PROFILE_ERROR_INVALID_HTTP_METHOD);
+ return 0;
}
- return 0;
+ return critical_error(LASSO_PROFILE_ERROR_INVALID_HTTP_METHOD);
}
/**
@@ -360,8 +360,7 @@ lasso_defederation_validate_notification(LassoDefederation *defederation)
profile->msg_url = lasso_provider_get_metadata_one(remote_provider,
"FederationTerminationServiceReturnURL");
if (profile->msg_url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Unknown profile service return URL");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
/* if a relay state, then build the query part */
diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c
index 714e19bb..8c1d0e5a 100644
--- a/lasso/id-ff/lecp.c
+++ b/lasso/id-ff/lecp.c
@@ -42,8 +42,7 @@ lasso_lecp_build_authn_request_envelope_msg(LassoLecp *lecp)
assertionConsumerServiceURL = lasso_provider_get_metadata_one(
LASSO_PROVIDER(profile->server), "AssertionConsumerServiceURL");
if (assertionConsumerServiceURL == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
if (profile->request == NULL) {
@@ -154,8 +153,7 @@ lasso_lecp_build_authn_response_envelope_msg(LassoLecp *lecp)
assertionConsumerServiceURL = lasso_provider_get_metadata_one(
provider, "AssertionConsumerServiceURL");
if (assertionConsumerServiceURL == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "AssertionConsumerServiceURL not found");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
if (LASSO_PROFILE(lecp)->msg_body)
diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c
index 82b3ebd1..e24aea5e 100644
--- a/lasso/id-ff/login.c
+++ b/lasso/id-ff/login.c
@@ -471,6 +471,9 @@ lasso_login_build_artifact_msg(LassoLogin *login, lassoHttpMethod http_method)
LASSO_PROFILE(login)->remote_providerID);
/* liberty-idff-bindings-profiles-v1.2.pdf p.25 */
url = lasso_provider_get_metadata_one(remote_provider, "AssertionConsumerServiceURL");
+ if (url == NULL) {
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
+ }
identityProviderSuccinctID = lasso_sha1(
LASSO_PROVIDER(LASSO_PROFILE(login)->server)->ProviderID);
@@ -579,7 +582,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
/* get SingleSignOnServiceURL metadata */
url = lasso_provider_get_metadata_one(remote_provider, "SingleSignOnServiceURL");
if (url == NULL) {
- return -1; /* XXX */
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
LASSO_PROFILE(login)->msg_url = g_strdup_printf("%s?%s", url, query);
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
index d9d62f3f..05fce4a4 100644
--- a/lasso/id-ff/logout.c
+++ b/lasso/id-ff/logout.c
@@ -94,8 +94,7 @@ lasso_logout_build_request_msg(LassoLogout *logout)
url = lasso_provider_get_metadata_one(remote_provider,
"SingleLogoutServiceURL");
if (url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Unknown profile service URL");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
query = lasso_node_export_to_query(profile->request,
profile->server->signature_method,
@@ -166,7 +165,7 @@ lasso_logout_build_response_msg(LassoLogout *logout)
if (profile->http_request_method == LASSO_HTTP_METHOD_REDIRECT) {
url = lasso_provider_get_metadata_one(provider, "SingleLogoutServiceReturnURL");
if (url == NULL) {
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
query = lasso_node_export_to_query(profile->response,
profile->server->signature_method,
@@ -525,6 +524,9 @@ lasso_logout_process_response_msg(LassoLogout *logout, gchar *response_msg)
/* Build and optionaly sign the logout request QUERY message */
url = lasso_provider_get_metadata_one(remote_provider,
"SingleLogoutServiceURL");
+ if (url == NULL) {
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
+ }
query = lasso_node_export_to_query(profile->request,
profile->server->signature_method,
profile->server->private_key);
diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c
index a0316c93..ef6875d9 100644
--- a/lasso/id-ff/name_identifier_mapping.c
+++ b/lasso/id-ff/name_identifier_mapping.c
@@ -54,8 +54,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
profile->msg_url = lasso_provider_get_metadata_one(remote_provider, "SoapEndpoint");
if (profile->msg_url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Name identifier mapping url not found");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
profile->msg_body = lasso_node_export_to_soap(profile->request,
diff --git a/lasso/id-ff/name_registration.c b/lasso/id-ff/name_registration.c
index 3916a3fc..7c4b6c0b 100644
--- a/lasso/id-ff/name_registration.c
+++ b/lasso/id-ff/name_registration.c
@@ -81,8 +81,7 @@ lasso_name_registration_build_request_msg(LassoNameRegistration *name_registrati
url = lasso_provider_get_metadata_one(remote_provider,
"RegisterNameIdentifierServiceURL");
if (url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Unknown profile service URL");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
query = lasso_node_export_to_query(profile->request,
profile->server->signature_method,
@@ -132,8 +131,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
url = lasso_provider_get_metadata_one(remote_provider,
"RegisterNameIdentifierServiceReturnURL");
if (url == NULL) {
- message(G_LOG_LEVEL_CRITICAL, "Unknown profile service URL");
- return -1;
+ return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
}
query = lasso_node_export_to_query(profile->response,
profile->server->signature_method,
diff --git a/lasso/xml/errors.c b/lasso/xml/errors.c
index 8e33e650..2ba1f268 100644
--- a/lasso/xml/errors.c
+++ b/lasso/xml/errors.c
@@ -87,6 +87,8 @@ lasso_strerror(int error_code)
return "ProviderID not found";
case LASSO_PROFILE_ERROR_UNSUPPORTED_PROFILE:
return "Unsupported protocol profile";
+ case LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL:
+ return "Unable to find Profile URL in metadata";
case LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ:
return "An object type provided as parameter "\
diff --git a/lasso/xml/errors.h b/lasso/xml/errors.h
index 821c5d79..bd63d334 100644
--- a/lasso/xml/errors.h
+++ b/lasso/xml/errors.h
@@ -65,6 +65,7 @@
#define LASSO_PROFILE_ERROR_INVALID_MSG -407
#define LASSO_PROFILE_ERROR_MISSING_REMOTE_PROVIDERID -408
#define LASSO_PROFILE_ERROR_UNSUPPORTED_PROFILE -409
+#define LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL -410
/* functions/methods parameters checking */
#define LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ -501