mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01: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
|
||||
{selected, [<<"data">>], [[SData]]} ->
|
||||
data_to_binary(ejabberd_odbc:decode_term(SData));
|
||||
data_to_binary(From, ejabberd_odbc:decode_term(SData));
|
||||
{'EXIT', _} -> error;
|
||||
{selected, _, _} -> empty
|
||||
end.
|
||||
@ -712,7 +712,7 @@ get_form(_ServerHost, _Host, _, _, _Lang) ->
|
||||
|
||||
set_data(ServerHost, Host, From, Data) ->
|
||||
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)).
|
||||
|
||||
set_data(_LServer, Host, From, Data, mnesia) ->
|
||||
@ -1218,27 +1218,36 @@ get_username_and_connection_params(Data) ->
|
||||
end,
|
||||
{Username, ConnParams}.
|
||||
|
||||
data_to_binary(Data) ->
|
||||
data_to_binary(JID, Data) ->
|
||||
lists:map(
|
||||
fun({username, U}) ->
|
||||
{username, iolist_to_binary(U)};
|
||||
({connections_params, Params}) ->
|
||||
{connections_params,
|
||||
lists:map(
|
||||
fun({S}) ->
|
||||
{iolist_to_binary(S)};
|
||||
({S, E}) ->
|
||||
{iolist_to_binary(S), iolist_to_binary(E)};
|
||||
({S, E, Port}) ->
|
||||
{iolist_to_binary(S), iolist_to_binary(E), Port};
|
||||
({S, E, Port, P}) ->
|
||||
{iolist_to_binary(S), iolist_to_binary(E),
|
||||
Port, iolist_to_binary(P)}
|
||||
end, Params)};
|
||||
{connections_params,
|
||||
lists:flatmap(
|
||||
fun(Param) ->
|
||||
try
|
||||
[conn_param_to_binary(Param)]
|
||||
catch _:_ ->
|
||||
?ERROR_MSG("failed to convert parameter "
|
||||
" ~p for user ~s",
|
||||
[Param, jlib:jid_to_string(JID)]),
|
||||
[]
|
||||
end
|
||||
end, Params)};
|
||||
(Opt) ->
|
||||
Opt
|
||||
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) ->
|
||||
lists:map(
|
||||
fun({S}) ->
|
||||
@ -1261,10 +1270,11 @@ update_table() ->
|
||||
fun(#irc_custom{us_host = {_, H}}) -> H end,
|
||||
fun(#irc_custom{us_host = {{U, S}, H},
|
||||
data = Data} = R) ->
|
||||
JID = jlib:make_jid(U, S, <<"">>),
|
||||
R#irc_custom{us_host = {{iolist_to_binary(U),
|
||||
iolist_to_binary(S)},
|
||||
iolist_to_binary(H)},
|
||||
data = data_to_binary(Data)}
|
||||
data = data_to_binary(JID, Data)}
|
||||
end);
|
||||
_ ->
|
||||
?INFO_MSG("Recreating irc_custom table", []),
|
||||
|
Loading…
Reference in New Issue
Block a user