]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Move prepare_stoken() call to generic openconnect_obtain_cookie()
authorDavid Woodhouse <dwmw2@infradead.org>
Mon, 5 Nov 2018 09:14:08 +0000 (10:14 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Mon, 5 Nov 2018 09:18:33 +0000 (10:18 +0100)
We were missing it for Juniper. Rather than adding a third copy of the
same code, put it in the generic caller.

Reported-by: Andy Wang <dopey@moonteeth.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
auth-globalprotect.c
auth.c
library.c

index f4c45742fe2cbe2cdc2cf2c8ba3de352b5b98bc8..f0247608a1ec5b65260adf4f66ba96bda68fbb02 100644 (file)
@@ -445,15 +445,6 @@ static int gpst_login(struct openconnect_info *vpninfo, int portal, struct login
        const char *request_body_type = "application/x-www-form-urlencoded";
        char *xml_buf = NULL, *orig_path;
 
-#ifdef HAVE_LIBSTOKEN
-       /* Step 1: Unlock software token (if applicable) */
-       if (vpninfo->token_mode == OC_TOKEN_MODE_STOKEN) {
-               result = prepare_stoken(vpninfo);
-               if (result)
-                       goto out;
-       }
-#endif
-
        /* Ask the user to fill in the auth form; repeat as necessary */
        for (;;) {
                /* submit prelogin request to get form */
diff --git a/auth.c b/auth.c
index ddbc68d4119fd252c654c01cd92d461ac33cff1d..07a9706a2b0c4e4ab3748ca8e48b13b297c2fc1c 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -1243,15 +1243,6 @@ int cstp_obtain_cookie(struct openconnect_info *vpninfo)
        int cert_rq, cert_sent = !vpninfo->cert;
        int newgroup_attempts = 5;
 
-#ifdef HAVE_LIBSTOKEN
-       /* Step 1: Unlock software token (if applicable) */
-       if (vpninfo->token_mode == OC_TOKEN_MODE_STOKEN) {
-               result = prepare_stoken(vpninfo);
-               if (result)
-                       goto out;
-       }
-#endif
-
        if (!vpninfo->xmlpost)
                goto no_xmlpost;
 
index e62c2fe09d818c94acc83e0e61ded315f4e8e5a0..4db85e152d33c3587d828466023ea473aa9b1cbc 100644 (file)
--- a/library.c
+++ b/library.c
@@ -236,6 +236,14 @@ int openconnect_setup_dtls(struct openconnect_info *vpninfo,
 
 int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
 {
+#ifdef HAVE_LIBSTOKEN
+       int ret;
+       if (vpninfo->token_mode == OC_TOKEN_MODE_STOKEN) {
+               ret = prepare_stoken(vpninfo);
+               if (ret)
+                       return ret;
+       }
+#endif
        return vpninfo->proto->obtain_cookie(vpninfo);
 }