]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
fix: support forms without "action"
authorJoachim Kuebart <joachim.kuebart@gmail.com>
Tue, 9 Mar 2021 12:45:35 +0000 (13:45 +0100)
committerJoachim Kuebart <joachim.kuebart@gmail.com>
Wed, 10 Mar 2021 21:19:37 +0000 (22:19 +0100)
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 <joachim.kuebart@gmail.com>
auth-juniper.c

index 43983f0eaea7957a6def3fa16b71ca3ef0ccedda..5eca0dd06d1583e920186e8a9cba47c402164d19 100644 (file)
@@ -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);