mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-10-12 09:32:05 +08:00
Indicate properly the status of TLS authentication when a client has reconnected.
This commit is contained in:
@@ -121,6 +121,28 @@ ssize_t tls_recv(gnutls_session_t session, void *data, size_t data_size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Typically used in a resumed session. It will return
|
||||||
|
* true if a certificate has been used.
|
||||||
|
*/
|
||||||
|
unsigned tls_has_session_cert(struct worker_st * ws)
|
||||||
|
{
|
||||||
|
unsigned int list_size = 0;
|
||||||
|
const gnutls_datum_t * certs;
|
||||||
|
|
||||||
|
if (ws->cert_auth_ok)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (ws->config->force_cert_auth != 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
certs = gnutls_certificate_get_peers(ws->session, &list_size);
|
||||||
|
if (certs != NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int __attribute__ ((format(printf, 2, 3)))
|
int __attribute__ ((format(printf, 2, 3)))
|
||||||
tls_printf(gnutls_session_t session, const char *fmt, ...)
|
tls_printf(gnutls_session_t session, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ size_t tls_get_overhead(gnutls_protocol_t, gnutls_cipher_algorithm_t, gnutls_mac
|
|||||||
|
|
||||||
void tls_close(gnutls_session_t session);
|
void tls_close(gnutls_session_t session);
|
||||||
|
|
||||||
|
unsigned tls_has_session_cert(struct worker_st * ws);
|
||||||
|
|
||||||
void tls_fatal_close(gnutls_session_t session,
|
void tls_fatal_close(gnutls_session_t session,
|
||||||
gnutls_alert_description_t a);
|
gnutls_alert_description_t a);
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -688,7 +688,8 @@ restart:
|
|||||||
*/
|
*/
|
||||||
complete_auth = 1;
|
complete_auth = 1;
|
||||||
ireq.user_name = ws->username;
|
ireq.user_name = ws->username;
|
||||||
} else
|
ireq.tls_auth_ok = tls_has_session_cert(ws);
|
||||||
|
} else {
|
||||||
#endif
|
#endif
|
||||||
if (ws->config->auth_types & AUTH_TYPE_USERNAME_PASS) {
|
if (ws->config->auth_types & AUTH_TYPE_USERNAME_PASS) {
|
||||||
ret =
|
ret =
|
||||||
@@ -724,6 +725,10 @@ restart:
|
|||||||
ireq.cert_group_name = tmp_group;
|
ireq.cert_group_name = tmp_group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ANYCONNECT_CLIENT_COMPAT
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
ireq.hostname = req->hostname;
|
ireq.hostname = req->hostname;
|
||||||
|
|
||||||
ret = send_msg_to_main(ws, AUTH_INIT,
|
ret = send_msg_to_main(ws, AUTH_INIT,
|
||||||
|
|||||||
Reference in New Issue
Block a user