Merge pull request #9124 from JimMoen/sub-acl-warning-log
Sub acl warning log
This commit is contained in:
commit
f51e2c7f95
|
@ -39,6 +39,8 @@ File format:
|
||||||
- Added a test to prevent a last will testament message to be
|
- Added a test to prevent a last will testament message to be
|
||||||
published when a client is denied connection. [#8894](https://github.com/emqx/emqx/pull/8894)
|
published when a client is denied connection. [#8894](https://github.com/emqx/emqx/pull/8894)
|
||||||
|
|
||||||
|
- Add warning log if the acl check of a subscribed topic failed. [#9124](https://github.com/emqx/emqx/pull/9124)
|
||||||
|
|
||||||
### Bug fixes
|
### Bug fixes
|
||||||
|
|
||||||
- Fix delayed publish inaccurate caused by os time change. [#8908](https://github.com/emqx/emqx/pull/8908)
|
- Fix delayed publish inaccurate caused by os time change. [#8908](https://github.com/emqx/emqx/pull/8908)
|
||||||
|
|
|
@ -1501,12 +1501,15 @@ check_pub_caps(#mqtt_packet{header = #mqtt_packet_header{qos = QoS,
|
||||||
check_sub_acls(TopicFilters, Channel) ->
|
check_sub_acls(TopicFilters, Channel) ->
|
||||||
check_sub_acls(TopicFilters, Channel, []).
|
check_sub_acls(TopicFilters, Channel, []).
|
||||||
|
|
||||||
check_sub_acls([ TopicFilter = {Topic, _} | More] , Channel, Acc) ->
|
check_sub_acls([ TopicFilter = {Topic, SubOpts} | More] , Channel, Acc) ->
|
||||||
case check_sub_acl(Topic, Channel) of
|
case check_sub_acl(Topic, Channel) of
|
||||||
allow ->
|
allow ->
|
||||||
check_sub_acls(More, Channel, [ {TopicFilter, 0} | Acc]);
|
check_sub_acls(More, Channel, [ {TopicFilter, 0} | Acc]);
|
||||||
deny ->
|
deny ->
|
||||||
check_sub_acls(More, Channel, [ {TopicFilter, ?RC_NOT_AUTHORIZED} | Acc])
|
ReasonCode = ?RC_NOT_AUTHORIZED,
|
||||||
|
?LOG(warning, "Cannot subscribe ~s with options ~p due to ~s.",
|
||||||
|
[Topic, SubOpts, emqx_reason_codes:text(ReasonCode)]),
|
||||||
|
check_sub_acls(More, Channel, [ {TopicFilter, ReasonCode} | Acc])
|
||||||
end;
|
end;
|
||||||
check_sub_acls([], _Channel, Acc) ->
|
check_sub_acls([], _Channel, Acc) ->
|
||||||
lists:reverse(Acc).
|
lists:reverse(Acc).
|
||||||
|
|
Loading…
Reference in New Issue