]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
stoken: Fix CSD/stoken interaction
authorKevin Cernekee <cernekee@gmail.com>
Sun, 28 Oct 2012 07:41:32 +0000 (00:41 -0700)
committerKevin Cernekee <cernekee@gmail.com>
Sun, 28 Oct 2012 08:22:56 +0000 (01:22 -0700)
When using CSD, the auth form could be parsed more than once per
connection.  Change the accounting so that stoken_tries only gets
incremented if a tokencode is actually generated.

Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
auth.c

diff --git a/auth.c b/auth.c
index 1092dbb004b9d17e9ff7465ad436a9377df194c9..5634224b8c52b99a9f66a62f5db022d23fe12cf6 100644 (file)
--- a/auth.c
+++ b/auth.c
@@ -973,8 +973,6 @@ static int can_gen_tokencode(struct openconnect_info *vpninfo, struct oc_form_op
                             _("Server is rejecting the soft token; switching to manual entry\n"));
                return -ENOENT;
        }
-
-       vpninfo->stoken_tries++;
        return 0;
 #else
        return -EOPNOTSUPP;
@@ -1010,6 +1008,7 @@ static int do_gen_tokencode(struct openconnect_info *vpninfo, struct oc_auth_for
                return -EIO;
        }
 
+       vpninfo->stoken_tries++;
        opt->value = strdup(tokencode);
        return opt->value ? 0 : -ENOMEM;
 #else