From 5c866d91b4ef3a69d73f4e843069a6bf7d5cf4ef Mon Sep 17 00:00:00 2001 From: turtled Date: Thu, 30 Mar 2017 09:43:35 +0800 Subject: [PATCH] support cascading multiple acl modules --- etc/acl.conf | 3 --- src/emqttd_acl_internal.erl | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/etc/acl.conf b/etc/acl.conf index 3cb3b8c52..2560bf80d 100644 --- a/etc/acl.conf +++ b/etc/acl.conf @@ -24,6 +24,3 @@ {deny, all, subscribe, ["$SYS/#", {eq, "#"}]}. -{allow, all}. - - diff --git a/src/emqttd_acl_internal.erl b/src/emqttd_acl_internal.erl index 1cd32c0f4..5305985c4 100644 --- a/src/emqttd_acl_internal.erl +++ b/src/emqttd_acl_internal.erl @@ -30,7 +30,7 @@ -define(ACL_RULE_TAB, mqtt_acl_rule). --record(state, {config, nomatch = allow}). +-record(state, {config}). %%-------------------------------------------------------------------- %% API @@ -86,11 +86,11 @@ filter(_PubSub, {_AllowDeny, _Who, _, _Topics}) -> State :: #state{}). check_acl(_Who, #state{config = undefined}) -> allow; -check_acl({Client, PubSub, Topic}, #state{nomatch = Default}) -> +check_acl({Client, PubSub, Topic}, #state{}) -> case match(Client, Topic, lookup(PubSub)) of {matched, allow} -> allow; {matched, deny} -> deny; - nomatch -> Default + nomatch -> ignore end. lookup(PubSub) ->