Use correct XML tag for CSD script on Mac
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 12 Jul 2012 12:12:50 +0000 (13:12 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 12 Jul 2012 12:57:37 +0000 (13:57 +0100)
Other operating systems still get the Linux version, and will need a
wrapper or something to make it cope.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
auth.c
library.c
main.c
openconnect-internal.h
www/changelog.xml

diff --git a/auth.c b/auth.c
index 5178e24..cdab5a3 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -394,7 +394,7 @@ int parse_xml_response(struct openconnect_info *vpninfo, char *response,
                        if (!vpninfo->csd_ticket)
                                vpninfo->csd_ticket = (char *)xmlGetProp(xml_node,
                                                                         (unsigned char *)"ticket");
-               } else if (!vpninfo->csd_scriptname && !strcmp((char *)xml_node->name, "csdLinux")) {
+               } else if (!vpninfo->csd_scriptname && !strcmp((char *)xml_node->name, vpninfo->csd_xmltag)) {
                        vpninfo->csd_stuburl = (char *)xmlGetProp(xml_node,
                                                                  (unsigned char *)"stuburl");
                        vpninfo->csd_starturl = (char *)xmlGetProp(xml_node,
index bd7db6e..b97f8df 100644 (file)
--- a/library.c
+++ b/library.c
@@ -46,6 +46,11 @@ struct openconnect_info *openconnect_vpninfo_new (char *useragent,
        vpninfo->progress = progress;
        vpninfo->cbdata = privdata?:vpninfo;
        vpninfo->cancel_fd = -1;
+#ifdef __APPLE__
+       vpninfo->csd_xmltag = "csdMac";
+#else
+       vpninfo->csd_xmltag = "csdLinux";
+#endif
 
 #ifdef ENABLE_NLS
        bindtextdomain("openconnect", LOCALEDIR);
diff --git a/main.c b/main.c
index e3f243e..25f184b 100644 (file)
--- a/main.c
+++ b/main.c
@@ -462,6 +462,13 @@ int main(int argc, char **argv)
        vpninfo->reconnect_interval = RECONNECT_INTERVAL_MIN;
        vpninfo->reconnect_timeout = 300;
        vpninfo->uid_csd = 0;
+       /* We could let them override this on the command line some day, perhaps */
+#ifdef __APPLE__
+       vpninfo->csd_xmltag = "csdMac";
+#else
+       vpninfo->csd_xmltag = "csdLinux";
+#endif
+       vpninfo->uid_csd = 0;
        vpninfo->uid_csd_given = 0;
        vpninfo->validate_peer_cert = validate_peer_cert;
        vpninfo->process_auth_form = process_auth_form;
index 51a3e26..6e0a10b 100644 (file)
@@ -126,6 +126,7 @@ struct pin_cache {
 struct openconnect_info {
        char *redirect_url;
 
+       const char *csd_xmltag;
        char *csd_token;
        char *csd_ticket;
        char *csd_stuburl;
index 8725892..be94266 100644 (file)
@@ -17,6 +17,7 @@
 <ul>
    <li><b>OpenConnect HEAD</b>
      <ul>
+       <li>Use correct CSD script for Mac OS X.</li>
        <li>Fix endless loop in PIN cache handling with multiple PKCS#11 tokens.</li>
        <li>Fix PKCS#11 URI handling to preserve all attributes.</li>
        <li>Don't forget key password on GUI reconnect.</li>