Skip to content

Commit

Permalink
Partial fix for Fortinet auth
Browse files Browse the repository at this point in the history
We have to fill in form->auth_id in all cases, and were forgetting in
the synthesised password form.

Also, on a redirect we would get an empty resp_buf from do_http_request()
which would cause a crash when we dereference it. Don't do that.

We still need some more work here (and a webview at least for the GUI
case) but this at least fixes the worst of it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 committed May 4, 2021
1 parent 8ca5868 commit 613fa87
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fortinet.c
Expand Up @@ -144,6 +144,9 @@ int fortinet_obtain_cookie(struct openconnect_info *vpninfo)
ret = -ENOMEM;
goto out;
}
form->auth_id = strdup("fortinet_auth");
if (!form->auth_id)
goto nomem;
opt = form->opts = calloc(1, sizeof(*opt));
if (!opt)
goto nomem;
Expand Down Expand Up @@ -207,7 +210,7 @@ int fortinet_obtain_cookie(struct openconnect_info *vpninfo)
}

/* XX: We got 200 status, but no SVPNCOOKIE. 2FA? */
if (ret >= 0 &&
if (ret > 0 &&
!strncmp(resp_buf, "ret=", 4) && strstr(resp_buf, ",tokeninfo=")) {
const char *prompt;
struct oc_text_buf *action_buf = buf_alloc();
Expand Down

0 comments on commit 613fa87

Please sign in to comment.