aboutsummaryrefslogtreecommitdiff
path: root/src/ejabberd_stun.erl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2020-04-22 00:16:03 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2020-04-22 00:16:03 +0200
commit09a87f5a0c7e67ce35478944cdb5b50ba3da0474 (patch)
treeb17800652ec99c6ffc340072a59ac821cb551466 /src/ejabberd_stun.erl
parentejabberd_stun: Add 'stun_get_password' hook (diff)
ejabberd_stun: Handle hashed passwords gracefully
Don't crash when STUN/TURN authentication is performed against a SCRAM-hashed password.
Diffstat (limited to 'src/ejabberd_stun.erl')
-rw-r--r--src/ejabberd_stun.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/ejabberd_stun.erl b/src/ejabberd_stun.erl
index b3527b3cf..a094f37ac 100644
--- a/src/ejabberd_stun.erl
+++ b/src/ejabberd_stun.erl
@@ -80,7 +80,14 @@ get_password(User, Realm) ->
Password when byte_size(Password) > 0 ->
Password;
<<>> ->
- ejabberd_auth:get_password_s(User, Realm)
+ case ejabberd_auth:get_password_s(User, Realm) of
+ Password when is_binary(Password) ->
+ Password;
+ _ ->
+ ?INFO_MSG("Cannot use hashed password of ~s@~s for "
+ "STUN/TURN authentication", [User, Realm]),
+ <<>>
+ end
end.
%%%===================================================================