From: Joachim Kuebart Date: Tue, 9 Mar 2021 12:45:35 +0000 (+0100) Subject: fix: support forms without "action" X-Git-Tag: v8.20~356^2~3 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cade4e18c8903dd9007629b08917b02d61e35af1;p=users%2Fdwmw2%2Fopenconnect.git 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 --- 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);