Skip to content

Commit

Permalink
[490] Fix auth plugin+WS client+MOSQ_ERR_AUTH related crash.
Browse files Browse the repository at this point in the history
Thanks to "hasunperera".

Bug: #490
  • Loading branch information
ralight committed Jul 26, 2017
1 parent 7943072 commit 2206301
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Broker:
- Fix memory leak if a client provided a username/password for a listener with
use_identity_as_username configured.
- Fix use_identity_as_username not working on websockets clients.
- Don't crash if an auth plugin returns MOSQ_ERR_AUTH for a username check on
a websockets client. Closes #490.

Client library:
- Fix incorrect PSK key being used if it had leading zeroes.
Expand Down
21 changes: 13 additions & 8 deletions lib/net_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,14 +214,19 @@ int _mosquitto_socket_close(struct mosquitto *mosq)

assert(mosq);
#ifdef WITH_TLS
if(mosq->ssl){
SSL_shutdown(mosq->ssl);
SSL_free(mosq->ssl);
mosq->ssl = NULL;
}
if(mosq->ssl_ctx){
SSL_CTX_free(mosq->ssl_ctx);
mosq->ssl_ctx = NULL;
#ifdef WITH_WEBSOCKETS
if(!mosq->wsi)
#endif
{
if(mosq->ssl){
SSL_shutdown(mosq->ssl);
SSL_free(mosq->ssl);
mosq->ssl = NULL;
}
if(mosq->ssl_ctx){
SSL_CTX_free(mosq->ssl_ctx);
mosq->ssl_ctx = NULL;
}
}
#endif

Expand Down

0 comments on commit 2206301

Please sign in to comment.