Authentication plugin acl_check function is passed local_username for local bridges.

This commit is contained in:
Roger A. Light 2014-10-29 22:11:18 +00:00
parent 0c3e4e50cc
commit 0a86aee5fb

View File

@ -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);
}
}