Commit 8e1fda4f authored by Kevin Cernekee's avatar Kevin Cernekee Committed by David Woodhouse

http: Fix redirect handling in auth form loop

The gateway may ask the user to fill out different forms that live at
different URLs, e.g.

    GET /+webvpn+/index.html
    (returns <form method="post" action="/+webvpn+/index.html"> and
     username/password form elements)
    POST /+webvpn+/index.html
    (returns <form method="post" action="/+webvpn+/login/challenge.html">
     and challenge/response form elements)
    POST /+webvpn+/login/challenge.html
    (returns <auth> node with valid cookie)

The refactored openconnect_obtain_cookie() loop tried to post the
challenge/response data to index.html, preventing successful login.  This
patch changes the logic so that it will honor the new "action" attribute
if present.

This probably does not affect XML POST mode, because XML POST <form> tags
do not seem to use attributes.
Reported-by: default avatarFabian Jäger <>
Signed-off-by: default avatarKevin Cernekee <>
Signed-off-by: default avatarDavid Woodhouse <>
parent e8a0cecc
......@@ -1072,6 +1072,10 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
result = parse_xml_response(vpninfo, form_buf, &form);
if (result < 0)
goto out;
if (form->action) {
vpninfo->redirect_url = strdup(form->action);
/* A return value of 2 means the XML form indicated
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment