]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
bugfix !165 Juniper forms handling
authorDaniel Lenski <dlenski@gmail.com>
Mon, 29 Mar 2021 23:59:08 +0000 (16:59 -0700)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 29 Mar 2021 23:59:08 +0000 (16:59 -0700)
I missed a small piece of my original "fix for forms with 'id' but no 'name'" (this one:
https://gitlab.com/openconnect/openconnect/-/commit/c8a6ee94180a09339eafefe0a2d889e7aa508e56#5503a3e92468be6db7c76e16b82bb5f3e9b14131_260_259)
in rebasing the ppp_core branch to merge cleanly with the changes from !171.

Caused this crash: https://gitlab.com/openconnect/openconnect/-/merge_requests/169#note_540411103

TODO: add Flask-based tests of Juniper auth to verify Juniper form handling.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
auth-html.c

index af1373dc87780d26382f8542bb7aa14d7bd0b262..b5c150e52cddbd3a9c4be313d559b49b37c610da 100644 (file)
@@ -216,11 +216,17 @@ struct oc_auth_form *parse_form_node(struct openconnect_info *vpninfo,
        }
 
        if (flavor == FORM_FLAVOR_JUNIPER) {
-               xmlnode_get_prop(node, "name", &form->auth_id);
-               form->banner = strdup(form->auth_id);
+               /* XX: some forms have 'id', but no 'name' */
+               if (!xmlnode_get_prop(node, "name", &form->auth_id) ||
+                   !xmlnode_get_prop(node, "id", &form->auth_id))
+                       form->banner = strdup(form->auth_id);
        } else if (flavor == FORM_FLAVOR_F5)
                xmlnode_get_prop(node, "id", &form->auth_id);
 
+       /* XX: fallback auth_id (since other functions expect it to exist) */
+       if (!form->auth_id)
+               form->auth_id = strdup("unknown");
+
        for (child = htmlnode_dive(node, node); child && child != node; child = htmlnode_dive(node, child)) {
                if (!child->name)
                        continue;