mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-08 21:43:07 +02:00
Ignore malformed parameters for mod_irc module
This commit is contained in:
parent
3e8a0af6d1
commit
6f4b4ad087
|
@ -601,7 +601,7 @@ get_data(LServer, Host, From, odbc) ->
|
||||||
<<"';">>])
|
<<"';">>])
|
||||||
of
|
of
|
||||||
{selected, [<<"data">>], [[SData]]} ->
|
{selected, [<<"data">>], [[SData]]} ->
|
||||||
data_to_binary(ejabberd_odbc:decode_term(SData));
|
data_to_binary(From, ejabberd_odbc:decode_term(SData));
|
||||||
{'EXIT', _} -> error;
|
{'EXIT', _} -> error;
|
||||||
{selected, _, _} -> empty
|
{selected, _, _} -> empty
|
||||||
end.
|
end.
|
||||||
|
@ -712,7 +712,7 @@ get_form(_ServerHost, _Host, _, _, _Lang) ->
|
||||||
|
|
||||||
set_data(ServerHost, Host, From, Data) ->
|
set_data(ServerHost, Host, From, Data) ->
|
||||||
LServer = jlib:nameprep(ServerHost),
|
LServer = jlib:nameprep(ServerHost),
|
||||||
set_data(LServer, Host, From, data_to_binary(Data),
|
set_data(LServer, Host, From, data_to_binary(From, Data),
|
||||||
gen_mod:db_type(LServer, ?MODULE)).
|
gen_mod:db_type(LServer, ?MODULE)).
|
||||||
|
|
||||||
set_data(_LServer, Host, From, Data, mnesia) ->
|
set_data(_LServer, Host, From, Data, mnesia) ->
|
||||||
|
@ -1218,27 +1218,36 @@ get_username_and_connection_params(Data) ->
|
||||||
end,
|
end,
|
||||||
{Username, ConnParams}.
|
{Username, ConnParams}.
|
||||||
|
|
||||||
data_to_binary(Data) ->
|
data_to_binary(JID, Data) ->
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({username, U}) ->
|
fun({username, U}) ->
|
||||||
{username, iolist_to_binary(U)};
|
{username, iolist_to_binary(U)};
|
||||||
({connections_params, Params}) ->
|
({connections_params, Params}) ->
|
||||||
{connections_params,
|
{connections_params,
|
||||||
lists:map(
|
lists:flatmap(
|
||||||
fun({S}) ->
|
fun(Param) ->
|
||||||
{iolist_to_binary(S)};
|
try
|
||||||
({S, E}) ->
|
[conn_param_to_binary(Param)]
|
||||||
{iolist_to_binary(S), iolist_to_binary(E)};
|
catch _:_ ->
|
||||||
({S, E, Port}) ->
|
?ERROR_MSG("failed to convert parameter "
|
||||||
{iolist_to_binary(S), iolist_to_binary(E), Port};
|
" ~p for user ~s",
|
||||||
({S, E, Port, P}) ->
|
[Param, jlib:jid_to_string(JID)]),
|
||||||
{iolist_to_binary(S), iolist_to_binary(E),
|
[]
|
||||||
Port, iolist_to_binary(P)}
|
end
|
||||||
end, Params)};
|
end, Params)};
|
||||||
(Opt) ->
|
(Opt) ->
|
||||||
Opt
|
Opt
|
||||||
end, Data).
|
end, Data).
|
||||||
|
|
||||||
|
conn_param_to_binary({S}) ->
|
||||||
|
{iolist_to_binary(S)};
|
||||||
|
conn_param_to_binary({S, E}) ->
|
||||||
|
{iolist_to_binary(S), iolist_to_binary(E)};
|
||||||
|
conn_param_to_binary({S, E, Port}) when is_integer(Port) ->
|
||||||
|
{iolist_to_binary(S), iolist_to_binary(E), Port};
|
||||||
|
conn_param_to_binary({S, E, Port, P}) when is_integer(Port) ->
|
||||||
|
{iolist_to_binary(S), iolist_to_binary(E), Port, iolist_to_binary(P)}.
|
||||||
|
|
||||||
conn_params_to_list(Params) ->
|
conn_params_to_list(Params) ->
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({S}) ->
|
fun({S}) ->
|
||||||
|
@ -1261,10 +1270,11 @@ update_table() ->
|
||||||
fun(#irc_custom{us_host = {_, H}}) -> H end,
|
fun(#irc_custom{us_host = {_, H}}) -> H end,
|
||||||
fun(#irc_custom{us_host = {{U, S}, H},
|
fun(#irc_custom{us_host = {{U, S}, H},
|
||||||
data = Data} = R) ->
|
data = Data} = R) ->
|
||||||
|
JID = jlib:make_jid(U, S, <<"">>),
|
||||||
R#irc_custom{us_host = {{iolist_to_binary(U),
|
R#irc_custom{us_host = {{iolist_to_binary(U),
|
||||||
iolist_to_binary(S)},
|
iolist_to_binary(S)},
|
||||||
iolist_to_binary(H)},
|
iolist_to_binary(H)},
|
||||||
data = data_to_binary(Data)}
|
data = data_to_binary(JID, Data)}
|
||||||
end);
|
end);
|
||||||
_ ->
|
_ ->
|
||||||
?INFO_MSG("Recreating irc_custom table", []),
|
?INFO_MSG("Recreating irc_custom table", []),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user