Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL_CTX is not cleared on disconnect - it conflicts with default MOSQ_OPT_SSL_CTX_WITH_DEFAULTS #2288

Closed
PoltoS opened this issue Aug 25, 2021 · 2 comments
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

Comments

@PoltoS
Copy link

PoltoS commented Aug 25, 2021

When no SSL_CTX is specified by the user, no MOSQ_OPT_SSL_CTX_WITH_DEFAULTS set (so by default mosq->ssl_ctx_defaults is true), on first run mosq->ssl_ctx is null, while on second it is already not null and it fall in the error here: https://github.com/eclipse/mosquitto/blob/master/lib/net_mosq.c#L671

So mosq_disconnect and then mosq_connect again will fail.

You should save the SSL_CTX defined by the user in another veriable mosq->user_ssl_ctx and copy it before each connect to ssl_ctx and clear in disconnect.

@ralight ralight added Component: libmosquitto Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. Type: Bug labels Aug 31, 2021
@ralight ralight added this to the 2.0.12 milestone Aug 31, 2021
@ralight
Copy link
Contributor

ralight commented Aug 31, 2021

Fixed in my local repo and will be part of 2.0.12 soon.

@ralight ralight added Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer. and removed Status: Accepted It's clear what the subject of the issue is about, and what the resolution should be. labels Aug 31, 2021
@ralight
Copy link
Contributor

ralight commented Aug 31, 2021

Thanks for the report!

@ralight ralight closed this as completed in d09591d Sep 1, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Component: libmosquitto Status: Completed Nothing further to be done with this issue, it can be closed by the requestor or committer. Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants