summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2007-01-05 13:40:07 +0000
committerFrederic Peters <fpeters@entrouvert.com>2007-01-05 13:40:07 +0000
commite636bd0680494533de1e0f2e520042f12f2f7f23 (patch)
tree44459fb47d815a81744bd54a5108798b8b97704d
parent46a2d6230274ae0bc6ae4f78895f09acc9f1c9f8 (diff)
downloadlasso-e636bd0680494533de1e0f2e520042f12f2f7f23.tar.gz
lasso-e636bd0680494533de1e0f2e520042f12f2f7f23.tar.xz
lasso-e636bd0680494533de1e0f2e520042f12f2f7f23.zip
new lasso_profile_clean_msg_info function used to clean msg_url and msg_body
(free()ing and setting to NULL) in functions where those variables are later set.
-rw-r--r--lasso/id-ff/defederation.c1
-rw-r--r--lasso/id-ff/lecp.c2
-rw-r--r--lasso/id-ff/login.c5
-rw-r--r--lasso/id-ff/logout.c2
-rw-r--r--lasso/id-ff/name_identifier_mapping.c2
-rw-r--r--lasso/id-ff/name_registration.c2
-rw-r--r--lasso/id-ff/profile.c13
-rw-r--r--lasso/id-ff/profileprivate.h1
-rw-r--r--lasso/saml-2.0/name_id_management.c2
9 files changed, 30 insertions, 0 deletions
diff --git a/lasso/id-ff/defederation.c b/lasso/id-ff/defederation.c
index 9d9ddef5..3ca2aca0 100644
--- a/lasso/id-ff/defederation.c
+++ b/lasso/id-ff/defederation.c
@@ -68,6 +68,7 @@ lasso_defederation_build_notification_msg(LassoDefederation *defederation)
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(defederation);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_defederation_init_notification was not called before */
diff --git a/lasso/id-ff/lecp.c b/lasso/id-ff/lecp.c
index d96c61aa..301eecc2 100644
--- a/lasso/id-ff/lecp.c
+++ b/lasso/id-ff/lecp.c
@@ -151,6 +151,8 @@ lasso_lecp_build_authn_response_msg(LassoLecp *lecp)
g_return_val_if_fail(LASSO_IS_LECP(lecp), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(lecp);
+ lasso_profile_clean_msg_info(profile);
+
profile->msg_url = g_strdup(lecp->assertionConsumerServiceURL);
if (profile->msg_url == NULL) {
return critical_error(LASSO_PROFILE_ERROR_UNKNOWN_PROFILE_URL);
diff --git a/lasso/id-ff/login.c b/lasso/id-ff/login.c
index 5169ae04..7ad10639 100644
--- a/lasso/id-ff/login.c
+++ b/lasso/id-ff/login.c
@@ -681,6 +681,7 @@ lasso_login_build_artifact_msg(LassoLogin *login, LassoHttpMethod http_method)
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
@@ -821,6 +822,7 @@ lasso_login_build_authn_request_msg(LassoLogin *login)
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
@@ -938,6 +940,7 @@ lasso_login_build_authn_response_msg(LassoLogin *login)
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
+ lasso_profile_clean_msg_info(profile);
IF_SAML2(profile) {
return lasso_saml20_login_build_authn_response_msg(login);
@@ -1011,6 +1014,7 @@ lasso_login_build_request_msg(LassoLogin *login)
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
+ lasso_profile_clean_msg_info(profile);
IF_SAML2(profile) {
return lasso_saml20_login_build_request_msg(login);
@@ -1058,6 +1062,7 @@ lasso_login_build_response_msg(LassoLogin *login, gchar *remote_providerID)
g_return_val_if_fail(LASSO_IS_LOGIN(login), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(login);
+ lasso_profile_clean_msg_info(profile);
IF_SAML2(profile) {
return lasso_saml20_login_build_response_msg(login, remote_providerID);
diff --git a/lasso/id-ff/logout.c b/lasso/id-ff/logout.c
index 0de3942e..6159e77c 100644
--- a/lasso/id-ff/logout.c
+++ b/lasso/id-ff/logout.c
@@ -75,6 +75,7 @@ lasso_logout_build_request_msg(LassoLogout *logout)
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(logout);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
@@ -167,6 +168,7 @@ lasso_logout_build_response_msg(LassoLogout *logout)
g_return_val_if_fail(LASSO_IS_LOGOUT(logout), LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
profile = LASSO_PROFILE(logout);
+ lasso_profile_clean_msg_info(profile);
IF_SAML2(profile) {
return lasso_saml20_logout_build_response_msg(logout);
diff --git a/lasso/id-ff/name_identifier_mapping.c b/lasso/id-ff/name_identifier_mapping.c
index bb92b067..566698da 100644
--- a/lasso/id-ff/name_identifier_mapping.c
+++ b/lasso/id-ff/name_identifier_mapping.c
@@ -61,6 +61,7 @@ lasso_name_identifier_mapping_build_request_msg(LassoNameIdentifierMapping *mapp
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(mapping);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
@@ -131,6 +132,7 @@ lasso_name_identifier_mapping_build_response_msg(LassoNameIdentifierMapping *map
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(mapping);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
diff --git a/lasso/id-ff/name_registration.c b/lasso/id-ff/name_registration.c
index 75acbb6b..f57e877a 100644
--- a/lasso/id-ff/name_registration.c
+++ b/lasso/id-ff/name_registration.c
@@ -65,6 +65,7 @@ lasso_name_registration_build_request_msg(LassoNameRegistration *name_registrati
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
@@ -152,6 +153,7 @@ lasso_name_registration_build_response_msg(LassoNameRegistration *name_registrat
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_registration);
+ lasso_profile_clean_msg_info(profile);
if (profile->remote_providerID == NULL) {
/* this means lasso_logout_init_request was not called before */
diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c
index dce0de9e..47738f63 100644
--- a/lasso/id-ff/profile.c
+++ b/lasso/id-ff/profile.c
@@ -312,6 +312,19 @@ lasso_profile_set_response_status(LassoProfile *profile, const char *statusCodeV
g_assert_not_reached();
}
+void
+lasso_profile_clean_msg_info(LassoProfile *profile)
+{
+ if (profile->msg_url) {
+ g_free(profile->msg_url);
+ profile->msg_url = NULL;
+ }
+ if (profile->msg_body) {
+ g_free(profile->msg_body);
+ profile->msg_body = NULL;
+ }
+}
+
/**
* lasso_profile_set_identity_from_dump:
diff --git a/lasso/id-ff/profileprivate.h b/lasso/id-ff/profileprivate.h
index ca747527..18e8e893 100644
--- a/lasso/id-ff/profileprivate.h
+++ b/lasso/id-ff/profileprivate.h
@@ -40,6 +40,7 @@ struct _LassoProfilePrivate
};
void lasso_profile_set_response_status(LassoProfile *profile, const gchar *statusCodeValue);
+void lasso_profile_clean_msg_info(LassoProfile *profile);
#ifdef __cplusplus
}
diff --git a/lasso/saml-2.0/name_id_management.c b/lasso/saml-2.0/name_id_management.c
index 63fc6b48..b8415acb 100644
--- a/lasso/saml-2.0/name_id_management.c
+++ b/lasso/saml-2.0/name_id_management.c
@@ -141,6 +141,7 @@ lasso_name_id_management_build_request_msg(LassoNameIdManagement *name_id_manage
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_id_management);
+ lasso_profile_clean_msg_info(profile);
remote_provider = g_hash_table_lookup(profile->server->providers,
profile->remote_providerID);
@@ -382,6 +383,7 @@ lasso_name_id_management_build_response_msg(LassoNameIdManagement *name_id_manag
g_return_val_if_fail(LASSO_IS_NAME_ID_MANAGEMENT(name_id_management),
LASSO_PARAM_ERROR_INVALID_VALUE);
profile = LASSO_PROFILE(name_id_management);
+ lasso_profile_clean_msg_info(profile);
if (profile->response == NULL) {
/* no response set here means request denied */