mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Don't crash on malformed 'modules' section
This commit is contained in:
parent
b30775a357
commit
8def827f9c
@ -713,10 +713,16 @@ process_term(Term, State) ->
|
|||||||
|
|
||||||
process_host_term(Term, Host, State, Action) ->
|
process_host_term(Term, Host, State, Action) ->
|
||||||
case Term of
|
case Term of
|
||||||
{modules, Modules} when Action == set ->
|
{modules, Modules} ->
|
||||||
set_option({modules, Host}, replace_modules(Modules), State);
|
Modules1 = try (gen_mod:opt_type(modules))(Modules) of
|
||||||
{modules, Modules} when Action == append ->
|
_ -> replace_modules(Modules)
|
||||||
append_option({modules, Host}, replace_modules(Modules), State);
|
catch _:_ -> Modules
|
||||||
|
end,
|
||||||
|
if Action == set ->
|
||||||
|
set_option({modules, Host}, Modules1, State);
|
||||||
|
Action == append ->
|
||||||
|
append_option({modules, Host}, Modules1, State)
|
||||||
|
end;
|
||||||
{host, _} ->
|
{host, _} ->
|
||||||
State;
|
State;
|
||||||
{hosts, _} ->
|
{hosts, _} ->
|
||||||
|
@ -937,8 +937,12 @@ opt_type(modules) ->
|
|||||||
fun(Mods) ->
|
fun(Mods) ->
|
||||||
lists:map(
|
lists:map(
|
||||||
fun({M, A}) when is_atom(M) ->
|
fun({M, A}) when is_atom(M) ->
|
||||||
true = is_opt_list(A),
|
case is_opt_list(A) of
|
||||||
{M, A}
|
true -> {M, A};
|
||||||
|
false ->
|
||||||
|
?ERROR_MSG("Malformed configuration format of module ~s", [M]),
|
||||||
|
erlang:error(badarg)
|
||||||
|
end
|
||||||
end, Mods)
|
end, Mods)
|
||||||
end;
|
end;
|
||||||
opt_type(_) -> [modules].
|
opt_type(_) -> [modules].
|
||||||
|
Loading…
Reference in New Issue
Block a user