From: Kevin Cernekee Date: Sun, 17 Feb 2013 00:18:06 +0000 (-0800) Subject: http: Fix redirect handling in auth form loop X-Git-Tag: v5.00~70 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8e1fda4f953fb9490b58287bb606903cd1830e08;p=users%2Fdwmw2%2Fopenconnect.git 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
and username/password form elements) POST /+webvpn+/index.html (returns and challenge/response form elements) POST /+webvpn+/login/challenge.html (returns 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 tags do not seem to use attributes. Reported-by: Fabian Jäger Signed-off-by: Kevin Cernekee Signed-off-by: David Woodhouse --- diff --git a/http.c b/http.c index bcc4e988..d6a3636c 100644 --- a/http.c +++ b/http.c @@ -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); + handle_redirect(vpninfo); + } } /* A return value of 2 means the XML form indicated