فهرست منبع

fix(authn/kerberos): allow disable without check

zmstone 1 سال پیش
والد
کامیت
be76a6e167

+ 2 - 0
apps/emqx_auth_kerberos/src/emqx_authn_kerberos.erl

@@ -47,6 +47,8 @@ resolve_keytab(<<"DEFAULT">>) ->
 resolve_keytab(Path) ->
     emqx_schema:naive_env_interpolation(Path).
 
+update(#{enable := false}, State) ->
+    {ok, State};
 update(Config, #{id := ID}) ->
     create(ID, Config).
 

+ 20 - 0
apps/emqx_auth_kerberos/test/emqx_authn_kerberos_SUITE.erl

@@ -69,6 +69,26 @@ t_create(_Config) ->
     {ok, [#{provider := emqx_authn_kerberos}]} =
         emqx_authn_chains:list_authenticators(?GLOBAL).
 
+t_disable_without_kinit(_Config) ->
+    ID = <<"gssapi:kerberos">>,
+    Create = raw_config(),
+    Disable = Create#{<<"enable">> => false},
+    DisableBadPrincipal = Disable#{<<"principal">> => <<"mqtt/a.b@REALM">>},
+    {ok, _} = emqx:update_config(
+        ?PATH,
+        {create_authenticator, ?GLOBAL, Create}
+    ),
+    {ok, _} = emqx:update_config(
+        ?PATH,
+        {update_authenticator, ?GLOBAL, ID, Disable}
+    ),
+    {ok, _} = emqx:update_config(
+        ?PATH,
+        {update_authenticator, ?GLOBAL, ID, DisableBadPrincipal}
+    ),
+    {ok, [#{provider := emqx_authn_kerberos}]} =
+        emqx_authn_chains:list_authenticators(?GLOBAL).
+
 t_create_invalid(_Config) ->
     %% cover the case when keytab_file is not provided
     InvalidConfig0 = maps:remove(<<"keytab_file">>, raw_config()),

+ 1 - 0
apps/emqx_durable_storage/src/emqx_ds_precondition.erl

@@ -98,6 +98,7 @@ matches_headers(#message{headers = Headers}, MatchHeaders) ->
 -ifdef(TEST).
 -include_lib("eunit/include/eunit.hrl").
 -compile(export_all).
+-compile(nowarn_export_all).
 
 conjunction_test() ->
     %% Contradictory preconditions, always false.