From: Daniel Lenski Date: Mon, 29 Mar 2021 23:59:08 +0000 (-0700) Subject: bugfix !165 Juniper forms handling X-Git-Tag: v8.20~325^2 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a07bbbcd711c6fc4ef20fd9719e0e5da40f141f9;p=users%2Fdwmw2%2Fopenconnect.git bugfix !165 Juniper forms handling 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 --- diff --git a/auth-html.c b/auth-html.c index af1373dc..b5c150e5 100644 --- a/auth-html.c +++ b/auth-html.c @@ -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;