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 at gmail.com> --- auth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/auth.c b/auth.c index 1092dbb..5634224 100644 --- 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 -- 1.7.10.4