Fix TLS certs and PSK not being able to be config'd at the same time.

This commit is contained in:
Roger A. Light
2021-08-19 17:26:04 +01:00
parent a37c8e65d2
commit 0143db71a1
2 changed files with 8 additions and 3 deletions
+2
View File
@@ -6,6 +6,8 @@ Broker:
configuration file. Unless your configuration file is writable by untrusted
users this is not a risk. Closes #567213.
- Fix `max_connections` option not being correctly counted.
- Fix TLS certificates and TLS-PSK not being able to be configured at the same
time.
Client library:
- If a client uses TLS-PSK then force the default cipher list to use "PSK"
+6 -3
View File
@@ -879,8 +879,9 @@ int net__socket_listen(struct mosquitto__listener *listener)
if(net__tls_load_verify(listener)){
return 1;
}
}
# ifdef FINAL_WITH_TLS_PSK
}else if(listener->psk_hint){
if(listener->psk_hint){
if(tls_ex_index_context == -1){
tls_ex_index_context = SSL_get_ex_new_index(0, "client context", NULL, NULL, NULL);
}
@@ -888,8 +889,10 @@ int net__socket_listen(struct mosquitto__listener *listener)
tls_ex_index_listener = SSL_get_ex_new_index(0, "listener", NULL, NULL, NULL);
}
if(net__tls_server_ctx(listener)){
return 1;
if(listener->certfile == NULL || listener->keyfile == NULL){
if(net__tls_server_ctx(listener)){
return 1;
}
}
SSL_CTX_set_psk_server_callback(listener->ssl_ctx, psk_server_callback);
if(listener->psk_hint){