diff options
| author | Frederic Peters <fpeters@entrouvert.com> | 2007-10-19 08:54:28 +0000 |
|---|---|---|
| committer | Frederic Peters <fpeters@entrouvert.com> | 2007-10-19 08:54:28 +0000 |
| commit | ea872ad761edd564b11a43ff6182465eae3c987e (patch) | |
| tree | 9d28222a9cb116f405e16f31c235b40a59c13ea1 | |
| parent | 007c08916217b5b706598e1060fe5c8e8454aefe (diff) | |
error checking when processing artifact response.
| -rw-r--r-- | lasso/saml-2.0/profile.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lasso/saml-2.0/profile.c b/lasso/saml-2.0/profile.c index 6a965c9d..34c5cd9d 100644 --- a/lasso/saml-2.0/profile.c +++ b/lasso/saml-2.0/profile.c @@ -279,10 +279,23 @@ int lasso_saml20_profile_process_artifact_response(LassoProfile *profile, const char *msg) { LassoNode *response; + LassoSamlp2ArtifactResponse *artifact_response; + + /* XXX: handle errors properly */ response = lasso_node_new_from_soap(msg); - /* XXX: check status code */ - profile->response = g_object_ref(LASSO_SAMLP2_ARTIFACT_RESPONSE(response)->any); + if (!LASSO_IS_SAMLP2_ARTIFACT_RESPONSE(response)) { + profile->response = lasso_samlp2_response_new(); + return LASSO_PROFILE_ERROR_INVALID_ARTIFACT; + } + artifact_response = LASSO_SAMLP2_ARTIFACT_RESPONSE(response); + + if (artifact_response->any == NULL) { + profile->response = lasso_samlp2_response_new(); + return LASSO_PROFILE_ERROR_MISSING_RESPONSE; + } + + profile->response = g_object_ref(artifact_response->any); lasso_node_destroy(response); return 0; |
