From d7ce81cd22b1c6e4826f8189cd1b75fd204eb0c4 Mon Sep 17 00:00:00 2001 From: Badlop Date: Wed, 11 May 2016 18:27:14 +0200 Subject: [PATCH] Fix problem registering users with ejabberd_auth_http https://www.ejabberd.im/forum/25450/issue-registration-users-over-bosh#new --- ejabberd_auth_http/src/scram2.erl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ejabberd_auth_http/src/scram2.erl b/ejabberd_auth_http/src/scram2.erl index 065cef0..fda4771 100644 --- a/ejabberd_auth_http/src/scram2.erl +++ b/ejabberd_auth_http/src/scram2.erl @@ -179,8 +179,15 @@ scram_to_tuple(Scram) -> -spec check_digest(scram(), binary(), fun(), binary()) -> boolean(). check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) -> - Passwd = base64:decode(StoredKey), - ejabberd_auth:check_digest(Digest, DigestGen, Password, Passwd). + Passwd = jlib:decode_base64(StoredKey), + DigRes = if Digest /= <<"">> -> + Digest == DigestGen(Passwd); + true -> false + end, + if DigRes -> true; + true -> (Passwd == Password) and (Password /= <<"">>) + end. + -ifdef(no_crypto_hmac). crypto_hmac(sha, Key, Data) ->