Fix MOSQ_OPT_SSL_CTX not being able to be set to NULL.

Closes #2289. Thanks to Poltorak Serguei.
pull/2343/head
Roger A. Light 4 years ago
parent 77af2ecefe
commit 605131502b

@ -50,6 +50,7 @@ Client library:
- Disable TLS v1.3 when using TLS-PSK, because it isn't correctly configured. - Disable TLS v1.3 when using TLS-PSK, because it isn't correctly configured.
- Threaded mode is deconfigured when the mosquitto_loop_start() thread ends, - Threaded mode is deconfigured when the mosquitto_loop_start() thread ends,
which allows mosquitto_loop_start() to be called again. Closes #2242. which allows mosquitto_loop_start() to be called again. Closes #2242.
- Fix MOSQ_OPT_SSL_CTX not being able to be set to NULL. Closes #2289.
Apps: Apps:
- Fix `mosquitto_ctrl dynsec setDefaultACLAccess` command not working. - Fix `mosquitto_ctrl dynsec setDefaultACLAccess` command not working.

@ -401,26 +401,17 @@ int mosquitto_opts_set(struct mosquitto *mosq, enum mosq_opt_t option, void *val
{ {
int ival; int ival;
if(!mosq || !value) return MOSQ_ERR_INVAL; if(!mosq) return MOSQ_ERR_INVAL;
switch(option){ switch(option){
case MOSQ_OPT_PROTOCOL_VERSION: case MOSQ_OPT_PROTOCOL_VERSION:
if(value == NULL){
return MOSQ_ERR_INVAL;
}
ival = *((int *)value); ival = *((int *)value);
return mosquitto_int_option(mosq, option, ival); return mosquitto_int_option(mosq, option, ival);
case MOSQ_OPT_SSL_CTX: case MOSQ_OPT_SSL_CTX:
#ifdef WITH_TLS return mosquitto_void_option(mosq, option, value);
mosq->ssl_ctx = (SSL_CTX *)value;
if(mosq->ssl_ctx){
#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
SSL_CTX_up_ref(mosq->ssl_ctx);
#else
CRYPTO_add(&(mosq->ssl_ctx)->references, 1, CRYPTO_LOCK_SSL_CTX);
#endif
}
break;
#else
return MOSQ_ERR_NOT_SUPPORTED;
#endif
default: default:
return MOSQ_ERR_INVAL; return MOSQ_ERR_INVAL;
} }
@ -512,7 +503,7 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val
int mosquitto_void_option(struct mosquitto *mosq, enum mosq_opt_t option, void *value) int mosquitto_void_option(struct mosquitto *mosq, enum mosq_opt_t option, void *value)
{ {
if(!mosq || !value) return MOSQ_ERR_INVAL; if(!mosq) return MOSQ_ERR_INVAL;
switch(option){ switch(option){
case MOSQ_OPT_SSL_CTX: case MOSQ_OPT_SSL_CTX:

Loading…
Cancel
Save