Merge pull request #7764 from HJianBo/fix-authn-proc-crash

fix(authn): avoid crashing emqx_authentication process due to un-safe call
This commit is contained in:
JianBo He 2022-04-26 10:06:53 +08:00 committed by GitHub
commit 81e9000c72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -417,6 +417,7 @@ list_users(ChainName, AuthenticatorID, FuzzyParams) ->
%%--------------------------------------------------------------------
init(_Opts) ->
process_flag(trap_exit, true),
ok = emqx_config_handler:add_handler([?CONF_ROOT], ?MODULE),
ok = emqx_config_handler:add_handler([listeners, '?', '?', ?CONF_ROOT], ?MODULE),
{ok, #{hooked => false, providers => #{}}}.
@ -784,7 +785,12 @@ update_chain(ChainName, UpdateFun) ->
[] ->
{error, {not_found, {chain, ChainName}}};
[Chain] ->
try
UpdateFun(Chain)
catch
Class:Reason:Stk ->
{error, {exception, {Class, Reason, Stk}}}
end
end.
call_authenticator(ChainName, AuthenticatorID, Func, Args) ->