From 21b372ed9e5b5a912f941a8fc7abf635feb853a4 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sat, 18 Apr 2015 22:16:57 +0100 Subject: [PATCH] ACLs are now checked before sending a will message. --- ChangeLog.txt | 1 + src/context.c | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 6f474c81..f8543ee6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -6,6 +6,7 @@ Broker: #464437. - Fix incorrect bridge connection notifications on local broker. - Fix persistent db writing on Windows. Closes #464779. +- ACLs are now checked before sending a will message. Client library: - Inflight message count wasn't being decreased for outgoing messages using diff --git a/src/context.c b/src/context.c index d39fbe18..1a82465a 100644 --- a/src/context.c +++ b/src/context.c @@ -188,8 +188,10 @@ void mqtt3_context_cleanup(struct mosquitto_db *db, struct mosquitto *context, b void mqtt3_context_disconnect(struct mosquitto_db *db, struct mosquitto *ctxt) { if(ctxt->state != mosq_cs_disconnecting && ctxt->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); + if(mosquitto_acl_check(db, ctxt, ctxt->will->topic, MOSQ_ACL_WRITE) == MOSQ_ERR_SUCCESS){ + /* 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); + } } if(ctxt->will){ if(ctxt->will->topic) _mosquitto_free(ctxt->will->topic);