summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamien Laniel <dlaniel@entrouvert.com>2007-07-05 13:10:23 +0000
committerDamien Laniel <dlaniel@entrouvert.com>2007-07-05 13:10:23 +0000
commit7a2d6aaf8ad40d52b0f50f34cb082e5fc21357d9 (patch)
treedb3f61522b70f655e7dacd884515221ba844b0c5
parent661486e124124116a9854070325391805e52e901 (diff)
check enveloppe existence in case lasso functions are called in wrong order
-rw-r--r--lasso/errors.c2
-rw-r--r--lasso/errors.h7
-rw-r--r--lasso/id-wsf-2.0/data_service.c12
3 files changed, 16 insertions, 5 deletions
diff --git a/lasso/errors.c b/lasso/errors.c
index 4b5b6538..7f051f73 100644
--- a/lasso/errors.c
+++ b/lasso/errors.c
@@ -189,6 +189,8 @@ lasso_strerror(int error_code)
case LASSO_SOAP_FAULT_REDIRECT_REQUEST:
return "Redirect request from Attribute Provider";
+ case LASSO_SOAP_ERROR_MISSING_ENVELOPE:
+ return "Missing SOAP envelope";
case LASSO_SOAP_ERROR_MISSING_HEADER:
return "Missing SOAP header";
case LASSO_SOAP_ERROR_MISSING_BODY:
diff --git a/lasso/errors.h b/lasso/errors.h
index 940a856a..7b06b295 100644
--- a/lasso/errors.h
+++ b/lasso/errors.h
@@ -128,9 +128,10 @@
/* Soap */
#define LASSO_SOAP_FAULT_REDIRECT_REQUEST 800
-#define LASSO_SOAP_ERROR_MISSING_HEADER -801
-#define LASSO_SOAP_ERROR_MISSING_BODY -802
-#define LASSO_SOAP_ERROR_MISSING_SOAP_FAULT_DETAIL -803
+#define LASSO_SOAP_ERROR_MISSING_ENVELOPE -801
+#define LASSO_SOAP_ERROR_MISSING_HEADER -802
+#define LASSO_SOAP_ERROR_MISSING_BODY -803
+#define LASSO_SOAP_ERROR_MISSING_SOAP_FAULT_DETAIL -804
/* Name Identifier Mapping */
#define LASSO_NAME_IDENTIFIER_MAPPING_ERROR_MISSING_TARGET_NAMESPACE -900
diff --git a/lasso/id-wsf-2.0/data_service.c b/lasso/id-wsf-2.0/data_service.c
index 49f6818a..24ba001e 100644
--- a/lasso/id-wsf-2.0/data_service.c
+++ b/lasso/id-wsf-2.0/data_service.c
@@ -199,6 +199,9 @@ lasso_idwsf2_data_service_parse_query_items(LassoIdWsf2DataService *service)
/* Response envelope and body */
envelope = profile->soap_envelope_response;
+ if (envelope == NULL) {
+ return LASSO_SOAP_ERROR_MISSING_ENVELOPE;
+ }
response = lasso_idwsf2_dstref_query_response_new();
response->prefixServiceType = g_strdup(request->prefixServiceType);
response->hrefServiceType = g_strdup(request->hrefServiceType);
@@ -429,6 +432,12 @@ lasso_idwsf2_data_service_init_redirect_user_for_consent(LassoIdWsf2DataService
LASSO_PARAM_ERROR_BAD_TYPE_OR_NULL_OBJ);
g_return_val_if_fail(redirect_url != NULL, LASSO_PARAM_ERROR_INVALID_VALUE);
+ /* Response envelope */
+ envelope = profile->soap_envelope_response;
+ if (envelope == NULL) {
+ return LASSO_SOAP_ERROR_MISSING_ENVELOPE;
+ }
+
/* Build soap fault node */
fault = lasso_soap_fault_new();
fault->faultcode = g_strdup(LASSO_SOAP_FAULT_CODE_SERVER);
@@ -438,8 +447,7 @@ lasso_idwsf2_data_service_init_redirect_user_for_consent(LassoIdWsf2DataService
detail->any, lasso_idwsf2_soap_binding2_redirect_request_new_full(redirect_url));
fault->Detail = detail;
- /* Response envelope */
- envelope = profile->soap_envelope_response;
+ /* Response envelope body */
envelope->Body->any = g_list_append(envelope->Body->any, fault);
return 0;