diff options
| author | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-02-04 00:02:24 +0000 |
|---|---|---|
| committer | Benjamin Dauvergne <bdauvergne@entrouvert.com> | 2010-02-04 00:02:24 +0000 |
| commit | 3bf8b2a44fb7c46182f8e075ab0131a74fa86053 (patch) | |
| tree | bbc666d5bf60a7ce1abfc9f8cf5da5acdad876aa | |
| parent | 8e1398e65cc14f6e73212f28b6d677ba56ce2086 (diff) | |
| download | lasso-3bf8b2a44fb7c46182f8e075ab0131a74fa86053.tar.gz lasso-3bf8b2a44fb7c46182f8e075ab0131a74fa86053.tar.xz lasso-3bf8b2a44fb7c46182f8e075ab0131a74fa86053.zip | |
Core: in lasso_profile_get_request_type_from_soap_msg use lasso_xml_parse_memory_with_error
* lasso/id-ff/profile.c: (lasso_profile_get_request_type_from_soap_msg)
use lasso_xml_parse_memory_with_error instead of xmlParseMemory, use
error code output argument to log error reports.
| -rw-r--r-- | lasso/id-ff/profile.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lasso/id-ff/profile.c b/lasso/id-ff/profile.c index d45d6584..a1db007a 100644 --- a/lasso/id-ff/profile.c +++ b/lasso/id-ff/profile.c @@ -164,11 +164,18 @@ lasso_profile_get_request_type_from_soap_msg(const gchar *soap) LassoRequestType type = LASSO_REQUEST_TYPE_INVALID; const char *name = NULL; xmlNs *ns = NULL; + xmlError error; + memset(&error, 0, sizeof(xmlError)); if (soap == NULL) return LASSO_REQUEST_TYPE_INVALID; - doc = xmlParseMemory(soap, strlen(soap)); + doc = lasso_xml_parse_memory_with_error(soap, strlen(soap), &error); + if (! doc) { + message(G_LOG_LEVEL_WARNING, "Invalid soap message: %s", error.message); + type = LASSO_REQUEST_TYPE_INVALID; + goto cleanup; + } xpathCtx = xmlXPathNewContext(doc); xmlXPathRegisterNs(xpathCtx, (xmlChar*)"s", (xmlChar*)LASSO_SOAP_ENV_HREF); xpathObj = xmlXPathEvalExpression((xmlChar*)"//s:Body/*", xpathCtx); @@ -220,8 +227,9 @@ lasso_profile_get_request_type_from_soap_msg(const gchar *soap) xmlXPathFreeObject(xpathObj); xmlXPathFreeContext(xpathCtx); +cleanup: lasso_release_doc(doc); - + xmlResetError(&error); return type; } |
