]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
F5: one of the GET requests in login flow appears unnecessary
authorDaniel Lenski <dlenski@gmail.com>
Mon, 8 Feb 2021 21:28:28 +0000 (13:28 -0800)
committerDaniel Lenski <dlenski@gmail.com>
Mon, 29 Mar 2021 03:13:30 +0000 (20:13 -0700)
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
f5.c
test-f5-login.py

diff --git a/f5.c b/f5.c
index cf12ffcba2ed49c157c2ac6568f83e2fcf08470c..ed7ce8242e0e33fbaa5285dcce0427a2d347a23f 100644 (file)
--- a/f5.c
+++ b/f5.c
@@ -45,8 +45,8 @@ int f5_obtain_cookie(struct openconnect_info *vpninfo)
        if ((ret = buf_error(resp_buf)))
                goto out;
 
-       /* XX: Is this initial GET / (to populate LastMRH_Session and MRHSession
-        * cookies) actually necessary?
+       /* XX: This initial 'GET /' seems to be necessary to populate LastMRH_Session and
+        * MRHSession cookies, without which the subsequent 'POST' will fail.
         */
        ret = do_https_request(vpninfo, "GET", NULL, NULL, &form_buf, 1);
        free(form_buf);
@@ -54,25 +54,13 @@ int f5_obtain_cookie(struct openconnect_info *vpninfo)
        if (ret < 0)
                return ret;
 
-       /* XX: Is this second GET /my.policy (to update MRHSession cookie)
-        * also necessary?
-        */
-       free(vpninfo->urlpath);
-       if (!(vpninfo->urlpath = strdup("my.policy"))) {
+       /* XX: build static form (username and password) */
+       form = calloc(1, sizeof(*form));
+       if (!form) {
        nomem:
                ret = -ENOMEM;
                goto out;
        }
-       ret = do_https_request(vpninfo, "GET", NULL, NULL, &form_buf, 1);
-       free(form_buf);
-       form_buf = NULL;
-       if (ret < 0)
-               return ret;
-
-       /* XX: build static form (username and password) */
-       form = calloc(1, sizeof(*form));
-       if (!form)
-               goto nomem;
        opt = form->opts = calloc(1, sizeof(*opt));
        if (!opt)
                goto nomem;
index aec2701e56674a64ec66227f141e40d387ffd81a..e6980183c5a825987bbfae0a13109db8fd31743e 100755 (executable)
@@ -52,8 +52,8 @@ s.verify = args.verify
 print("Initial GET / to populate LastMRH_Session and MRHSession cookies...", file=stderr)
 res = s.get(endpoint.geturl(), allow_redirects=False)
 assert any(c.value for c in s.cookies if c.name=='MRHSession') and any(c.value for c in s.cookies if c.name=='LastMRH_Session')
-print("GET /my.policy to update MRHSession cookie...", file=stderr)
-res = s.get(endpoint._replace(path='/my.policy').geturl(), allow_redirects=False, headers={'Referer': res.url})
+#print("GET /my.policy to update MRHSession cookie...", file=stderr)
+#res = s.get(endpoint._replace(path='/my.policy').geturl(), allow_redirects=False, headers={'Referer': res.url})
 #print("GET /vdesk/timeoutagent-i.php to update TIN cookie (probably unnecessary).")
 #res = s.get(endpoint._replace(path='/vdesk/timeoutagent-i.php').geturl(), allow_redirects=False)