diff options
| author | Nicolas Clapies <nclapies@entrouvert.com> | 2004-08-24 08:37:18 +0000 |
|---|---|---|
| committer | Nicolas Clapies <nclapies@entrouvert.com> | 2004-08-24 08:37:18 +0000 |
| commit | d9394ebec65df7628fd52d4fa4863df4e80d78a6 (patch) | |
| tree | c770cfb45fbd0aab546eccf405be1ad8659c8842 | |
| parent | 20eb1ff2e370040b5fa7fa135974c4447340a1db (diff) | |
| download | lasso-d9394ebec65df7628fd52d4fa4863df4e80d78a6.tar.gz lasso-d9394ebec65df7628fd52d4fa4863df4e80d78a6.tar.xz lasso-d9394ebec65df7628fd52d4fa4863df4e80d78a6.zip | |
added error messages if invalid attributes in logout object while setting building request and message
| -rw-r--r-- | lasso/id-ff/logout.c | 110 |
1 files changed, 66 insertions, 44 deletions
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c index 6d727247..1ed4b534 100644 --- a/lasso/id-ff/logout.c +++ b/lasso/id-ff/logout.c @@ -114,6 +114,11 @@ lasso_logout_build_request_msg(LassoLogout *logout) lassoProviderTypeSp, NULL); } + else { + message(G_LOG_LEVEL_CRITICAL, "Invalid provider type\n"); + ret = -1; + goto done; + } if (protocolProfile == NULL) { message(G_LOG_LEVEL_CRITICAL, "Single logout protocol profile not found\n"); @@ -133,6 +138,12 @@ lasso_logout_build_request_msg(LassoLogout *logout) lassoProviderTypeIdp, NULL); profile->msg_body = lasso_node_export_to_soap(profile->request); + + if (profile->msg_url == NULL || profile->msg_body == NULL ) { + message(G_LOG_LEVEL_CRITICAL, "Error while setting msg_url and msg_body\n"); + ret = -1; + goto done; + } } else if (xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloSpHttp) || \ xmlStrEqual(protocolProfile,lassoLibProtocolProfileSloIdpHttp)) { @@ -149,6 +160,12 @@ lasso_logout_build_request_msg(LassoLogout *logout) g_sprintf(profile->msg_url, "%s?%s", url, query); profile->msg_body = NULL; + if (profile->msg_url == NULL) { + message(G_LOG_LEVEL_CRITICAL, "Error while setting msg_url\n"); + ret = -1; + goto done; + } + xmlFree(url); xmlFree(query); } @@ -411,6 +428,11 @@ lasso_logout_init_request(LassoLogout *logout, else if (profile->provider_type == lassoProviderTypeSp) { singleLogoutProtocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider, lassoProviderTypeIdp, NULL); } + else { + message(G_LOG_LEVEL_CRITICAL, "Invalid provider type\n"); + ret = -1; + goto done; + } if (singleLogoutProtocolProfile == NULL) { message(G_LOG_LEVEL_CRITICAL, "Single logout protocol profile not found\n"); @@ -682,51 +704,51 @@ lasso_logout_validate_request(LassoLogout *logout) /* if SOAP request method at IDP then verify all the remote service providers support SOAP protocol profile. If one remote authenticated principal service provider doesn't support SOAP then return UnsupportedProfile to original service provider */ -/* if (profile->provider_type==lassoProviderTypeIdp && profile->http_request_method==lassoHttpMethodSoap) { */ -/* gboolean all_http_soap; */ -/* LassoProvider *provider; */ -/* gchar *providerID, *protocolProfile; */ -/* int i; */ + if (profile->provider_type==lassoProviderTypeIdp && profile->http_request_method==lassoHttpMethodSoap) { + gboolean all_http_soap; + LassoProvider *provider; + gchar *providerID, *protocolProfile; + int i; -/* all_http_soap = TRUE; */ - -/* for (i = 0; i<profile->server->providers->len; i++) { */ -/* provider = g_ptr_array_index(profile->server->providers, i); */ -/* providerID = lasso_provider_get_providerID(provider); */ - -/* /\* if the original service provider then continue *\/ */ -/* if (xmlStrEqual(remote_providerID, providerID)) { */ -/* continue; */ -/* } */ - -/* /\* if principal is not authenticated with this remote service provider, continue *\/ */ -/* assertion = lasso_session_get_assertion(profile->session, providerID); */ -/* if (assertion == NULL) { */ -/* continue; */ -/* } */ - -/* /\* if protocolProfile is SOAP continue else break *\/ */ -/* protocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider, lassoProviderTypeIdp, NULL); */ -/* if (protocolProfile == NULL || !xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap)) { */ -/* all_http_soap = FALSE; */ -/* break; */ -/* } */ - -/* if (protocolProfile != NULL) { */ -/* xmlFree(protocolProfile); */ -/* } */ - -/* if (providerID != NULL) { */ -/* xmlFree(providerID); */ -/* } */ -/* } */ - -/* if (all_http_soap==FALSE) { */ -/* statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeUnsupportedProfile); */ -/* ret = -1; */ -/* goto done; */ -/* } */ -/* } */ + all_http_soap = TRUE; + + for (i = 0; i<profile->server->providers->len; i++) { + provider = g_ptr_array_index(profile->server->providers, i); + providerID = lasso_provider_get_providerID(provider); + + /* if the original service provider then continue */ + if (xmlStrEqual(remote_providerID, providerID)) { + continue; + } + + /* if principal is not authenticated with this remote service provider, continue */ + assertion = lasso_session_get_assertion(profile->session, providerID); + if (assertion == NULL) { + continue; + } + + /* if protocolProfile is SOAP continue else break */ + protocolProfile = lasso_provider_get_singleLogoutProtocolProfile(provider, lassoProviderTypeIdp, NULL); + if (protocolProfile == NULL || !xmlStrEqual(protocolProfile, lassoLibProtocolProfileSloSpSoap)) { + all_http_soap = FALSE; + break; + } + + if (protocolProfile != NULL) { + xmlFree(protocolProfile); + } + + if (providerID != NULL) { + xmlFree(providerID); + } + } + + if (all_http_soap==FALSE) { + statusCode_class->set_prop(statusCode, "Value", lassoLibStatusCodeUnsupportedProfile); + ret = -1; + goto done; + } + } lasso_federation_destroy(federation); |
