From cb57cfa1a64f6381b9081c88646d70d99f544ad7 Mon Sep 17 00:00:00 2001 From: HAMANO Tsukasa Date: Mon, 19 Jan 2015 15:25:58 +0900 Subject: [PATCH 1/2] correct fix for #396 --- src/cyrsasl_scram.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cyrsasl_scram.erl b/src/cyrsasl_scram.erl index 26e037001..8516b1734 100644 --- a/src/cyrsasl_scram.erl +++ b/src/cyrsasl_scram.erl @@ -79,7 +79,7 @@ mech_step(#state{step = 2} = State, ClientIn) -> {Ret, _AuthModule} = (State#state.get_password)(UserName), case {Ret, jlib:resourceprep(Ret)} of {false, _} -> {error, <<"not-authorized">>, UserName}; - {_, error} -> ?WARNING_MSG("invalid password", []), {error, <<"not-authorized">>, UserName}; + {_, error} when is_list(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, <<"not-authorized">>, UserName}; {Ret, _} -> {StoredKey, ServerKey, Salt, IterationCount} = if is_tuple(Ret) -> Ret; From e01eb734b4c30e9ee6efa937baaa436867b48af3 Mon Sep 17 00:00:00 2001 From: HAMANO Tsukasa Date: Mon, 19 Jan 2015 16:00:18 +0900 Subject: [PATCH 2/2] correct fix for #396 --- src/cyrsasl_scram.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cyrsasl_scram.erl b/src/cyrsasl_scram.erl index 8516b1734..dfd5d900d 100644 --- a/src/cyrsasl_scram.erl +++ b/src/cyrsasl_scram.erl @@ -79,7 +79,7 @@ mech_step(#state{step = 2} = State, ClientIn) -> {Ret, _AuthModule} = (State#state.get_password)(UserName), case {Ret, jlib:resourceprep(Ret)} of {false, _} -> {error, <<"not-authorized">>, UserName}; - {_, error} when is_list(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, <<"not-authorized">>, UserName}; + {_, error} when is_binary(Ret) -> ?WARNING_MSG("invalid plain password", []), {error, <<"not-authorized">>, UserName}; {Ret, _} -> {StoredKey, ServerKey, Salt, IterationCount} = if is_tuple(Ret) -> Ret;