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:
|
%% Check if IP is blacklisted:
|
||||||
case is_ip_blacklisted(IP) of
|
case is_ip_blacklisted(IP) of
|
||||||
true ->
|
true ->
|
||||||
?INFO_MSG("Connection attempt from blacklisted IP: ~s",
|
?INFO_MSG("Connection attempt from blacklisted IP: ~s (~w)",
|
||||||
[jlib:ip_to_list(IP)]),
|
[jlib:ip_to_list(IP), IP]),
|
||||||
{stop, normal};
|
{stop, normal};
|
||||||
false ->
|
false ->
|
||||||
Socket1 =
|
Socket1 =
|
||||||
|
@ -387,8 +387,8 @@ e(X) -> exit({bad_encode_base64_token, X}).
|
|||||||
%% Convert Erlang inet IP to list
|
%% Convert Erlang inet IP to list
|
||||||
ip_to_list({IP, _Port}) ->
|
ip_to_list({IP, _Port}) ->
|
||||||
ip_to_list(IP);
|
ip_to_list(IP);
|
||||||
ip_to_list({A,B,C,D}) ->
|
ip_to_list(IpTuple) when is_tuple(IpTuple) ->
|
||||||
lists:flatten(io_lib:format("~w.~w.~w.~w",[A,B,C,D])).
|
inet_parse:ntoa(IpTuple).
|
||||||
|
|
||||||
% --------------------------------------------------------------------
|
% --------------------------------------------------------------------
|
||||||
% Compat layer.
|
% Compat layer.
|
||||||
|
Loading…
Reference in New Issue
Block a user