mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
send session information from worker to parent twice
That allows to account changes after DTLS is established (e.g., send the DTLS ciphersuite name).
This commit is contained in:
@@ -131,7 +131,7 @@ typedef struct proc_st {
|
||||
* purposes (from main-ctl-handler). */
|
||||
char user_agent[MAX_AGENT_NAME];
|
||||
char tls_ciphersuite[MAX_CIPHERSUITE_NAME];
|
||||
char dtls_ciphersuite[MAX_DTLS_CIPHERSUITE_NAME];
|
||||
char dtls_ciphersuite[MAX_CIPHERSUITE_NAME];
|
||||
|
||||
/* pointer to the cookie used by this session */
|
||||
struct cookie_entry_st *cookie_ptr;
|
||||
|
||||
@@ -522,8 +522,8 @@ int handle_list_users_cmd(dbus_ctx *ctx, const char *arg)
|
||||
|
||||
print_time_ival7(t, out);
|
||||
if (dtls_ciphersuite != NULL && dtls_ciphersuite[0] != 0) {
|
||||
if (strncmp(dtls_ciphersuite, "OC-DTLS", 7) == 0 && strlen(dtls_ciphersuite) > 11)
|
||||
dtls_ciphersuite += 11;
|
||||
if (strncmp(dtls_ciphersuite, "(DTLS1.2)-(RSA)-", 16) == 0)
|
||||
dtls_ciphersuite += 16;
|
||||
fprintf(out, " %14s %9s\n", dtls_ciphersuite, auth);
|
||||
} else {
|
||||
fprintf(out, " %14s %9s\n", "(no dtls)", auth);
|
||||
|
||||
@@ -504,8 +504,8 @@ int handle_list_users_cmd(struct unix_ctx *ctx, const char *arg)
|
||||
|
||||
dtls_ciphersuite = rep->user[i]->dtls_ciphersuite;
|
||||
if (dtls_ciphersuite != NULL && dtls_ciphersuite[0] != 0) {
|
||||
if (strncmp(dtls_ciphersuite, "OC-DTLS", 7) == 0 && strlen(dtls_ciphersuite) > 11)
|
||||
dtls_ciphersuite += 11;
|
||||
if (strncmp(dtls_ciphersuite, "(DTLS1.2)-(RSA)-", 16) == 0)
|
||||
dtls_ciphersuite += 16;
|
||||
fprintf(out, " %14s %9s\n", dtls_ciphersuite, rep->user[i]->status);
|
||||
} else {
|
||||
fprintf(out, " %14s %9s\n", "(no dtls)", rep->user[i]->status);
|
||||
|
||||
@@ -98,7 +98,6 @@ extern int syslog_open;
|
||||
|
||||
#define MAX_AUTH_SECS 40
|
||||
#define MAX_CIPHERSUITE_NAME 64
|
||||
#define MAX_DTLS_CIPHERSUITE_NAME 24
|
||||
#define MAX_MSG_SIZE 256
|
||||
#define SID_SIZE 12
|
||||
|
||||
|
||||
@@ -883,9 +883,9 @@ void session_info_send(worker_st * ws)
|
||||
msg.tls_ciphersuite = gnutls_session_get_desc(ws->session);
|
||||
}
|
||||
|
||||
if (ws->udp_state != UP_DISABLED) {
|
||||
if (ws->udp_state != UP_DISABLED && ws->dtls_session) {
|
||||
msg.dtls_ciphersuite =
|
||||
(char *)ws->req.selected_ciphersuite->oc_name;
|
||||
gnutls_session_get_desc(ws->dtls_session);
|
||||
}
|
||||
|
||||
if (ws->req.user_agent[0] != 0) {
|
||||
@@ -897,6 +897,7 @@ void session_info_send(worker_st * ws)
|
||||
(pack_func) session_info_msg__pack);
|
||||
|
||||
gnutls_free(msg.tls_ciphersuite);
|
||||
gnutls_free(msg.dtls_ciphersuite);
|
||||
}
|
||||
|
||||
/* mtu_set: Sets the MTU for the session
|
||||
@@ -1212,6 +1213,7 @@ static int dtls_mainloop(worker_st * ws, struct timespec *tnow)
|
||||
oclog(ws, LOG_DEBUG,
|
||||
"DTLS handshake completed (plaintext MTU: %u)\n",
|
||||
ws->conn_mtu);
|
||||
session_info_send(ws);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user