Fix use of MOSQ_OPT_TLS_ENGINE
being unable to be used.
This was due to the openssl ctx not being initialised until starting to connect. Closes #2537. Thanks to chessing-c4.
This commit is contained in:
parent
127c5e7577
commit
b6b8039914
@ -11,6 +11,8 @@ Broker:
|
||||
Client library:
|
||||
- Fix threads library detection on Windows under cmake. Bumps the minimum
|
||||
cmake version to 3.1, which is still ancient.
|
||||
- Fix use of `MOSQ_OPT_TLS_ENGINE` being unable to be used due to the openssl
|
||||
ctx not being initialised until starting to connect. Closes #2537.
|
||||
|
||||
Clients:
|
||||
- Fix mosquitto_pub incorrectly reusing topic aliases when reconnecting.
|
||||
|
@ -1565,6 +1565,9 @@ libmosq_EXPORT int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t
|
||||
* MOSQ_OPT_TLS_ENGINE - Configure the client for TLS Engine support.
|
||||
* Pass a TLS Engine ID to be used when creating TLS
|
||||
* connections. Must be set before <mosquitto_connect>.
|
||||
* Must be a valid engine, and note that the string will not be used
|
||||
* until a connection attempt is made so this function will return
|
||||
* success even if an invalid engine string is passed.
|
||||
*
|
||||
* MOSQ_OPT_TLS_KEYFORM - Configure the client to treat the keyfile
|
||||
* differently depending on its type. Must be set
|
||||
|
@ -284,14 +284,17 @@ int mosquitto_string_option(struct mosquitto *mosq, enum mosq_opt_t option, cons
|
||||
switch(option){
|
||||
case MOSQ_OPT_TLS_ENGINE:
|
||||
#if defined(WITH_TLS) && !defined(OPENSSL_NO_ENGINE)
|
||||
eng = ENGINE_by_id(value);
|
||||
if(!eng){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
ENGINE_free(eng); /* release the structural reference from ENGINE_by_id() */
|
||||
mosq->tls_engine = mosquitto__strdup(value);
|
||||
if(!mosq->tls_engine){
|
||||
return MOSQ_ERR_NOMEM;
|
||||
mosquitto__free(mosq->tls_engine);
|
||||
if(value){
|
||||
eng = ENGINE_by_id(value);
|
||||
if(!eng){
|
||||
return MOSQ_ERR_INVAL;
|
||||
}
|
||||
ENGINE_free(eng); /* release the structural reference from ENGINE_by_id() */
|
||||
mosq->tls_engine = mosquitto__strdup(value);
|
||||
if(!mosq->tls_engine){
|
||||
return MOSQ_ERR_NOMEM;
|
||||
}
|
||||
}
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user