[PATCH V3] Fix --os=win

Antonio Borneo borneo.antonio at gmail.com
Sun Dec 8 03:32:55 EST 2013


Running OpenConnect with flag "--os=win" we get
        vpninfo->csd_xmltag == "csd"
In fact, in library.c we have:
     85         else if (!strcmp(os, "win"))
     86                 vpninfo->csd_xmltag = "csd";

In current code, the case (vpninfo->csd_xmltag == "csd") is
grabbed by previous "else if()" condition and not evaluated
anymore to extract "stuburl", "starturl" and "waiturl".

Split the "else if" in independent statement.
Modify comment above the function.

Signed-off-by: Antonio Borneo <borneo.antonio at gmail.com>
---

V1 -> V2: modify comments above function parse_auth_node()
V2 -> V3: recover commit message

 auth.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/auth.c b/auth.c
index f28e350..88ee0f1 100644
--- a/auth.c
+++ b/auth.c
@@ -367,9 +367,9 @@ static int xmlnode_get_text(xmlNode *xml_node, const char *name, char **var)
  *   <title><!-- title to display to user --></title>
  *   <csd token="<!-- save to vpninfo->csd_token -->"
  *        ticket="<!-- save to vpninfo->csd_ticket -->" />
- *   <csd stuburl="<!-- ignore -->"
- *        starturl="<!-- ignore -->"
- *        waiturl="<!-- ignore -->"
+ *   <csd stuburl="<!-- save to vpninfo->csd_stuburl when "--os=win" -->"
+ *        starturl="<!-- save to vpninfo->csd_starturl when "--os=win" -->"
+ *        waiturl="<!-- save to vpninfo->csd_waiturl when "--os=win" -->"
  *   <csdMac
  *           stuburl="<!-- save to vpninfo->csd_stuburl on Mac only -->"
  *           starturl="<!-- save to vpninfo->csd_starturl on Mac only -->"
@@ -454,7 +454,8 @@ static int parse_auth_node(struct openconnect_info *vpninfo, xmlNode *xml_node,
 		} else if (!vpninfo->csd_scriptname && xmlnode_is_named(xml_node, "csd")) {
 			xmlnode_get_prop(xml_node, "token", &vpninfo->csd_token);
 			xmlnode_get_prop(xml_node, "ticket", &vpninfo->csd_ticket);
-		} else if (!vpninfo->csd_scriptname && xmlnode_is_named(xml_node, vpninfo->csd_xmltag)) {
+		}
+		if (!vpninfo->csd_scriptname && xmlnode_is_named(xml_node, vpninfo->csd_xmltag)) {
 			xmlnode_get_prop(xml_node, "stuburl", &vpninfo->csd_stuburl);
 			xmlnode_get_prop(xml_node, "starturl", &vpninfo->csd_starturl);
 			xmlnode_get_prop(xml_node, "waiturl", &vpninfo->csd_waiturl);
-- 
1.7.3.4




More information about the openconnect-devel mailing list