ACLs are now checked before sending a will message.

This commit is contained in:
Roger A. Light 2015-04-18 22:16:57 +01:00
parent 991f1173d7
commit 21b372ed9e
2 changed files with 5 additions and 2 deletions

View File

@ -6,6 +6,7 @@ Broker:
#464437. #464437.
- Fix incorrect bridge connection notifications on local broker. - Fix incorrect bridge connection notifications on local broker.
- Fix persistent db writing on Windows. Closes #464779. - Fix persistent db writing on Windows. Closes #464779.
- ACLs are now checked before sending a will message.
Client library: Client library:
- Inflight message count wasn't being decreased for outgoing messages using - Inflight message count wasn't being decreased for outgoing messages using

View File

@ -188,9 +188,11 @@ void mqtt3_context_cleanup(struct mosquitto_db *db, struct mosquitto *context, b
void mqtt3_context_disconnect(struct mosquitto_db *db, struct mosquitto *ctxt) void mqtt3_context_disconnect(struct mosquitto_db *db, struct mosquitto *ctxt)
{ {
if(ctxt->state != mosq_cs_disconnecting && ctxt->will){ if(ctxt->state != mosq_cs_disconnecting && ctxt->will){
if(mosquitto_acl_check(db, ctxt, ctxt->will->topic, MOSQ_ACL_WRITE) == MOSQ_ERR_SUCCESS){
/* Unexpected disconnect, queue the client will. */ /* Unexpected disconnect, queue the client will. */
mqtt3_db_messages_easy_queue(db, ctxt, ctxt->will->topic, ctxt->will->qos, ctxt->will->payloadlen, ctxt->will->payload, ctxt->will->retain); mqtt3_db_messages_easy_queue(db, ctxt, ctxt->will->topic, ctxt->will->qos, ctxt->will->payloadlen, ctxt->will->payload, ctxt->will->retain);
} }
}
if(ctxt->will){ if(ctxt->will){
if(ctxt->will->topic) _mosquitto_free(ctxt->will->topic); if(ctxt->will->topic) _mosquitto_free(ctxt->will->topic);
if(ctxt->will->payload) _mosquitto_free(ctxt->will->payload); if(ctxt->will->payload) _mosquitto_free(ctxt->will->payload);