From cade4e18c8903dd9007629b08917b02d61e35af1 Mon Sep 17 00:00:00 2001 From: Joachim Kuebart Date: Tue, 9 Mar 2021 13:45:35 +0100 Subject: [PATCH] fix: support forms without "action" The HTML spec states: If action is the empty string, let action be the URL of the form document. https://html.spec.whatwg.org/#concept-form-submit This occurs for me in a scenario using Azure SSO. Signed-off-by: Joachim Kuebart --- auth-juniper.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/auth-juniper.c b/auth-juniper.c index 43983f0e..5eca0dd0 100644 --- a/auth-juniper.c +++ b/auth-juniper.c @@ -248,8 +248,7 @@ static struct oc_auth_form *parse_form_node(struct openconnect_info *vpninfo, xmlnode_get_prop(node, "method", &form->method); xmlnode_get_prop(node, "action", &form->action); - if (!form->method || strcasecmp(form->method, "POST") || - !form->action || !form->action[0]) { + if (!form->method || strcasecmp(form->method, "POST")) { vpn_progress(vpninfo, PRG_ERR, _("Cannot handle form method='%s', action='%s'\n"), form->method, form->action); @@ -826,12 +825,15 @@ int oncp_obtain_cookie(struct openconnect_info *vpninfo) if (ret) break; - vpninfo->redirect_url = form->action; - form->action = NULL; + if (form->action) { + vpninfo->redirect_url = form->action; + form->action = NULL; + } do_redirect: free_auth_form(form); form = NULL; - handle_redirect(vpninfo); + if (vpninfo->redirect_url) + handle_redirect(vpninfo); tncc_done: xmlFreeDoc(doc); -- 2.49.0