From 4cfe4e9940cd49e4627e466cce26520a39f0234a Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Fri, 6 Nov 2020 21:53:25 +0100 Subject: [PATCH] fix(eqmx_sasl): Dialyzer warning --- apps/emqx_sasl/src/emqx_sasl_app.erl | 4 ++-- apps/emqx_sasl/src/emqx_sasl_scram.erl | 8 ++------ apps/emqx_sn/src/emqx_sn_gateway.erl | 2 +- rebar.config | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/apps/emqx_sasl/src/emqx_sasl_app.erl b/apps/emqx_sasl/src/emqx_sasl_app.erl index 24c246ea9..9d0b5955c 100644 --- a/apps/emqx_sasl/src/emqx_sasl_app.erl +++ b/apps/emqx_sasl/src/emqx_sasl_app.erl @@ -30,7 +30,7 @@ start(_Type, _Args) -> ok = emqx_sasl:init(), - emqx_sasl:load(), + _ = emqx_sasl:load(), emqx_sasl_cli:load(), supervisor:start_link({local, ?MODULE}, ?MODULE, []). @@ -43,4 +43,4 @@ stop(_State) -> %%-------------------------------------------------------------------- init([]) -> - {ok, { {one_for_all, 1, 10}, []} }. \ No newline at end of file + {ok, { {one_for_all, 1, 10}, []} }. diff --git a/apps/emqx_sasl/src/emqx_sasl_scram.erl b/apps/emqx_sasl/src/emqx_sasl_scram.erl index f5aed5b3b..ba27f7784 100644 --- a/apps/emqx_sasl/src/emqx_sasl_scram.erl +++ b/apps/emqx_sasl/src/emqx_sasl_scram.erl @@ -217,12 +217,8 @@ nonce() -> base64:encode([$a + rand:uniform(26) || _ <- lists:seq(1, 10)]). pbkdf2_sha_1(Password, Salt, IterationCount) -> - case pbkdf2:pbkdf2(sha, Password, Salt, IterationCount) of - {ok, Bin} -> - pbkdf2:to_hex(Bin); - {error, Reason} -> - error(Reason) - end. + {ok, Bin} = pbkdf2:pbkdf2(sha, Password, Salt, IterationCount), + pbkdf2:to_hex(Bin). -if(?OTP_RELEASE >= 23). hmac(Key, Data) -> diff --git a/apps/emqx_sn/src/emqx_sn_gateway.erl b/apps/emqx_sn/src/emqx_sn_gateway.erl index a1e062add..ebe28cb1e 100644 --- a/apps/emqx_sn/src/emqx_sn_gateway.erl +++ b/apps/emqx_sn/src/emqx_sn_gateway.erl @@ -209,7 +209,7 @@ idle(cast, {incoming, ?SN_PUBLISH_MSG(#mqtt_sn_flags{qos = ?QOS_NEG1, emqx_broker:publish(Msg); false -> ok - end; + end, ?LOG(debug, "Client id=~p receives a publish with QoS=-1 in idle mode!", [ClientId], State), {keep_state_and_data, State#state.idle_timeout}; diff --git a/rebar.config b/rebar.config index 8999d9e97..146f46706 100644 --- a/rebar.config +++ b/rebar.config @@ -44,7 +44,7 @@ , {minirest, {git, "https://github.com/emqx/minirest", {tag, "0.3.2"}}} , {ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.0"}}} , {replayq, {git, "https://github.com/emqx/replayq", {tag, "v0.2.0"}}} - , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.3"}}} + , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}} , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.3"}}} , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}} , {getopt, "1.0.1"}