mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-03-16 06:49:19 +08:00
Use a macro for the DTLS-PSK protocol indicator
Also corrected its usage in worker-http
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#define MAX_MSG_SIZE 16*1024
|
||||
#define DTLS_PROTO_INDICATOR "PSK-NEGOTIATE"
|
||||
|
||||
enum {
|
||||
PS_AUTH_INACTIVE, /* no comm with worker */
|
||||
|
||||
@@ -269,8 +269,8 @@ void header_value_check(struct worker_st *ws, struct http_req_st *req)
|
||||
req->selected_ciphersuite = NULL;
|
||||
str = (char *)value;
|
||||
|
||||
p = strstr(str, "PSK-NEGOTIATE");
|
||||
if (p != NULL && (p[3] == 0 || p[3] == ':')) {
|
||||
p = strstr(str, DTLS_PROTO_INDICATOR);
|
||||
if (p != NULL && (p[sizeof(DTLS_PROTO_INDICATOR)-1] == 0 || p[sizeof(DTLS_PROTO_INDICATOR)-1] == ':')) {
|
||||
/* OpenConnect DTLS setup was detected. */
|
||||
req->use_psk = 1;
|
||||
req->master_secret_set = 1; /* we don't need it */
|
||||
|
||||
@@ -1969,9 +1969,9 @@ static int connect_handler(worker_st * ws)
|
||||
SEND_ERR(ret);
|
||||
|
||||
if (ws->req.use_psk || !ws->config->cisco_client_compat) {
|
||||
oclog(ws, LOG_INFO, "DTLS ciphersuite: PSK-NEGOTIATE");
|
||||
oclog(ws, LOG_INFO, "DTLS ciphersuite: "DTLS_PROTO_INDICATOR);
|
||||
ret =
|
||||
cstp_printf(ws, "X-DTLS-CipherSuite: PSK-NEGOTIATE\r\n");
|
||||
cstp_printf(ws, "X-DTLS-CipherSuite: "DTLS_PROTO_INDICATOR"\r\n");
|
||||
} else {
|
||||
oclog(ws, LOG_INFO, "DTLS ciphersuite: %s",
|
||||
ws->req.selected_ciphersuite->oc_name);
|
||||
|
||||
Reference in New Issue
Block a user