aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2013-03-30 08:10:39 +0100
committerAndreas Steffen <andreas.steffen@strongswan.org>2013-03-30 08:10:39 +0100
commit14bf3cc1bd6dd6b175ebe7667769d3a24e01d346 (patch)
tree10eb5b305976ea73641ea371bee0c84d82961b49 /src
parentcd13c9a90f76bf6edeaa893b3f46a32c4909c026 (diff)
downloadstrongswan-14bf3cc1bd6dd6b175ebe7667769d3a24e01d346.tar.bz2
strongswan-14bf3cc1bd6dd6b175ebe7667769d3a24e01d346.tar.xz
added IF-MAP SOAP error handling
Diffstat (limited to 'src')
-rw-r--r--src/libcharon/plugins/tnc_ifmap2/tnc_ifmap2_soap_msg.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/libcharon/plugins/tnc_ifmap2/tnc_ifmap2_soap_msg.c b/src/libcharon/plugins/tnc_ifmap2/tnc_ifmap2_soap_msg.c
index 7bea62d83..b7f8a5ed7 100644
--- a/src/libcharon/plugins/tnc_ifmap2/tnc_ifmap2_soap_msg.c
+++ b/src/libcharon/plugins/tnc_ifmap2/tnc_ifmap2_soap_msg.c
@@ -51,8 +51,8 @@ struct private_tnc_ifmap2_soap_msg_t {
/**
* Send HTTP POST request and receive HTTP response
*/
-static bool http_send_receive(private_tnc_ifmap2_soap_msg_t *this,
- chunk_t out, chunk_t *in)
+static bool http_post(private_tnc_ifmap2_soap_msg_t *this, chunk_t out,
+ chunk_t *in)
{
char header[] =
"POST /ifmap HTTP/1.1\r\n"
@@ -150,9 +150,9 @@ METHOD(tnc_ifmap2_soap_msg_t, post, bool,
char *result_name, xmlNodePtr *result)
{
xmlDocPtr doc;
- xmlNodePtr env, body, cur;
+ xmlNodePtr env, body, cur, response;
xmlNsPtr ns;
- xmlChar *xml;
+ xmlChar *xml, *errorCode, *errorString;
int len;
chunk_t in, out;
@@ -176,8 +176,8 @@ METHOD(tnc_ifmap2_soap_msg_t, post, bool,
DBG3(DBG_TNC, "%.*s", len, xml);
out = chunk_create(xml, len);
- /* Send SOAP-XML request via HTTP */
- if (!http_send_receive(this, out, &in))
+ /* Send SOAP-XML request via HTTP POST */
+ if (!http_post(this, out, &in))
{
xmlFree(xml);
return FALSE;
@@ -217,16 +217,39 @@ METHOD(tnc_ifmap2_soap_msg_t, post, bool,
}
/* get IF-MAP response */
- cur = find_child(cur, "response");
- if (!cur)
+ response = find_child(cur, "response");
+ if (!response)
{
return FALSE;
}
/* get IF-MAP result */
- cur = find_child(cur, result_name);
+ cur = find_child(response, result_name);
if (!cur)
{
+ cur = find_child(response, "errorResult");
+ if (cur)
+ {
+ DBG1(DBG_TNC, "received errorResult");
+
+ errorCode = xmlGetProp(cur, "errorCode");
+ if (errorCode)
+ {
+ DBG1(DBG_TNC, " %s", errorCode);
+ xmlFree(errorCode);
+ }
+
+ cur = find_child(cur, "errorString");
+ if (cur)
+ {
+ errorString = xmlNodeGetContent(cur);
+ if (errorString)
+ {
+ DBG1(DBG_TNC, " %s", errorString);
+ xmlFree(errorString);
+ }
+ }
+ }
return FALSE;
}