Merge pull request #4087 from zmstone/fix-auth-ldap
fix(auth_ldap): do not load plugin when no params configured
This commit is contained in:
commit
e96d03dc1b
|
@ -93,6 +93,19 @@ jobs:
|
||||||
unzip _packages/emqx/$pkg_name
|
unzip _packages/emqx/$pkg_name
|
||||||
gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
|
gsed -i '/emqx_telemetry/d' ./emqx/data/loaded_plugins
|
||||||
./emqx/bin/emqx start || cat emqx/log/erlang.log.1
|
./emqx/bin/emqx start || cat emqx/log/erlang.log.1
|
||||||
|
ready='no'
|
||||||
|
for i in {1..10}; do
|
||||||
|
if curl -fs 127.0.0.1:18083 > /dev/null; then
|
||||||
|
ready='yes'
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if [ "$ready" != "yes" ]; then
|
||||||
|
echo "Timed out waiting for emqx to be ready"
|
||||||
|
cat emqx/log/erlang.log.1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
./emqx/bin/emqx_ctl status
|
./emqx/bin/emqx_ctl status
|
||||||
./emqx/bin/emqx stop
|
./emqx/bin/emqx stop
|
||||||
rm -rf emqx
|
rm -rf emqx
|
||||||
|
|
|
@ -60,6 +60,7 @@ load_acl_hook(DeviceDn) ->
|
||||||
|
|
||||||
if_enabled(Cfgs, Fun) ->
|
if_enabled(Cfgs, Fun) ->
|
||||||
case get_env(Cfgs) of
|
case get_env(Cfgs) of
|
||||||
|
{ok, []} -> ok;
|
||||||
{ok, InitArgs} -> Fun(InitArgs)
|
{ok, InitArgs} -> Fun(InitArgs)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,11 @@ pgvar(Sql, Params) ->
|
||||||
%% PostgreSQL Connect/Query
|
%% PostgreSQL Connect/Query
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
%% Due to a bug in epgsql the caluse for `econnrefused` is not recognised by
|
||||||
|
%% dialyzer, result in this error:
|
||||||
|
%% The pattern {'error', Reason = 'econnrefused'} can never match the type ...
|
||||||
|
%% https://github.com/epgsql/epgsql/issues/246
|
||||||
|
-dialyzer([{nowarn_function, [connect/1]}]).
|
||||||
connect(Opts) ->
|
connect(Opts) ->
|
||||||
Host = proplists:get_value(host, Opts),
|
Host = proplists:get_value(host, Opts),
|
||||||
Username = proplists:get_value(username, Opts),
|
Username = proplists:get_value(username, Opts),
|
||||||
|
@ -64,6 +69,9 @@ connect(Opts) ->
|
||||||
{ok, C} ->
|
{ok, C} ->
|
||||||
conn_post(C),
|
conn_post(C),
|
||||||
{ok, C};
|
{ok, C};
|
||||||
|
{error, Reason = econnrefused} ->
|
||||||
|
?LOG(error, "[Postgres] Can't connect to Postgres server: Connection refused."),
|
||||||
|
{error, Reason};
|
||||||
{error, Reason = invalid_authorization_specification} ->
|
{error, Reason = invalid_authorization_specification} ->
|
||||||
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid authorization specification."),
|
?LOG(error, "[Postgres] Can't connect to Postgres server: Invalid authorization specification."),
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
|
|
|
@ -259,13 +259,13 @@ handle_received_create(TopicPrefix, MaxAge, Payload) ->
|
||||||
{error, bad_request}
|
{error, bad_request}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% http_uri:decode/1 is deprecated in OTP-23
|
%% @private Copy from http_uri.erl which has been deprecated since OTP-23
|
||||||
%% its equivalent uri_string:percent_decode however is not available before OTP 23
|
percent_decode(<<$%, Hex:2/binary, Rest/bits>>) ->
|
||||||
-if(?OTP_RELEASE >= 23).
|
<<(binary_to_integer(Hex, 16)), (percent_decode(Rest))/binary>>;
|
||||||
percent_decode(Topic) -> uri_string:percent_decode(Topic).
|
percent_decode(<<First:1/binary, Rest/bits>>) ->
|
||||||
-else.
|
<<First/binary, (percent_decode(Rest))/binary>>;
|
||||||
percent_decode(Topic) -> http_uri:decode(Topic).
|
percent_decode(<<>>) ->
|
||||||
-endif.
|
<<>>.
|
||||||
|
|
||||||
%% When topic is timeout, server should return nocontent here,
|
%% When topic is timeout, server should return nocontent here,
|
||||||
%% but gen_coap only receive return value of #coap_content from coap_get, so temporarily we can't give the Code 2.07 {ok, nocontent} out.TBC!!!
|
%% but gen_coap only receive return value of #coap_content from coap_get, so temporarily we can't give the Code 2.07 {ok, nocontent} out.TBC!!!
|
||||||
|
|
Loading…
Reference in New Issue