mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Fix crash in ejabberd_c2s when blacklist hook returned true (thanks to Jonas Ådahl)
Cause of the crash jlib:ip_to_list/1 only supports IP tuples using the form {N1,N2,N3,N4} which is not the case when IPv6 is enabled.
This commit is contained in:
parent
91dee14ad6
commit
81546f3270
@ -243,8 +243,8 @@ init([{SockMod, Socket}, Opts, FSMLimitOpts]) ->
|
||||
%% Check if IP is blacklisted:
|
||||
case is_ip_blacklisted(IP) of
|
||||
true ->
|
||||
?INFO_MSG("Connection attempt from blacklisted IP: ~s",
|
||||
[jlib:ip_to_list(IP)]),
|
||||
?INFO_MSG("Connection attempt from blacklisted IP: ~s (~w)",
|
||||
[jlib:ip_to_list(IP), IP]),
|
||||
{stop, normal};
|
||||
false ->
|
||||
Socket1 =
|
||||
|
@ -387,8 +387,8 @@ e(X) -> exit({bad_encode_base64_token, X}).
|
||||
%% Convert Erlang inet IP to list
|
||||
ip_to_list({IP, _Port}) ->
|
||||
ip_to_list(IP);
|
||||
ip_to_list({A,B,C,D}) ->
|
||||
lists:flatten(io_lib:format("~w.~w.~w.~w",[A,B,C,D])).
|
||||
ip_to_list(IpTuple) when is_tuple(IpTuple) ->
|
||||
inet_parse:ntoa(IpTuple).
|
||||
|
||||
% --------------------------------------------------------------------
|
||||
% Compat layer.
|
||||
|
Loading…
Reference in New Issue
Block a user