From 0a86aee5fb2dac52f22ddd9b152c288679e35045 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Wed, 29 Oct 2014 22:11:18 +0000 Subject: [PATCH] Authentication plugin acl_check function is passed local_username for local bridges. --- src/security.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/security.c b/src/security.c index bd9476d1..78268906 100644 --- a/src/security.c +++ b/src/security.c @@ -194,13 +194,23 @@ int mosquitto_security_cleanup(struct mosquitto_db *db, bool reload) int mosquitto_acl_check(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int access) { + char *username; + if(!context->id){ return MOSQ_ERR_ACL_DENIED; } if(!db->auth_plugin.lib){ return mosquitto_acl_check_default(db, context, topic, access); }else{ - return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, context->username, topic, access); +#ifdef WITH_BRIDGE + if(context->bridge){ + username = context->bridge->local_username; + }else +#endif + { + username = context->username; + } + return db->auth_plugin.acl_check(db->auth_plugin.user_data, context->id, username, topic, access); } }