Skip to content

Commit

Permalink
Move prepare_stoken() call to generic openconnect_obtain_cookie()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dwmw2 committed Nov 5, 2018
1 parent c7140a5 commit 0c605cf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
9 changes: 0 additions & 9 deletions auth-globalprotect.c
Expand Up @@ -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 */
Expand Down
9 changes: 0 additions & 9 deletions auth.c
Expand Up @@ -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;

Expand Down
8 changes: 8 additions & 0 deletions library.c
Expand Up @@ -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);
}

Expand Down

0 comments on commit 0c605cf

Please sign in to comment.