MOSQ_OPT_SSL_CTX using SSL_CTX defaults is broken #2463
Labels
Component: libmosquitto
Status: Completed
Nothing further to be done with this issue, it can be closed by the requestor or committer.
Type: Bug
Milestone
I'm pretty sure this is a regression (I haven't tested on older versions of libmosquitto but debugged for my use case) caused by d5aae3e. Basically in the baseline example for this functionality should be:
and libmosquitto should essentially still work for connecting to TLS. However, it errors out with an error message:
In net_mosq.c, from commit d5aae3e, the
net__init_tls()
call is only invoked ifmosq->ssl_ctx
hasn't been created yet. This is always hit in the case of MOSQ_OPT_SSL_CTX being specified. I think it should always be invoked (e.g. move up the invocation ofnet__init_tls()
one line to just outside of the check formosq->ssl_ctx
already being instantiated) sincenet__init_tls()
has an internal check if it's been already run already. This appears to fix the case of the example above where you instantiate the TLS instance outside of libmosquitto and otherwise leave it to defaults.(It might need to be always invoked from
net__init_ssl_ctx(...)
to maintain prior behavior when MOSQ_OPT_SSL_CTX was created; I'm not sure of the interactions with users that aren't using MOSQ_OPT_SSL_CTX_WITH_DEFAULTS.)Thanks,
Tim
The text was updated successfully, but these errors were encountered: