mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +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) ->
|
||||
case Term of
|
||||
{modules, Modules} when Action == set ->
|
||||
set_option({modules, Host}, replace_modules(Modules), State);
|
||||
{modules, Modules} when Action == append ->
|
||||
append_option({modules, Host}, replace_modules(Modules), State);
|
||||
{modules, Modules} ->
|
||||
Modules1 = try (gen_mod:opt_type(modules))(Modules) of
|
||||
_ -> replace_modules(Modules)
|
||||
catch _:_ -> Modules
|
||||
end,
|
||||
if Action == set ->
|
||||
set_option({modules, Host}, Modules1, State);
|
||||
Action == append ->
|
||||
append_option({modules, Host}, Modules1, State)
|
||||
end;
|
||||
{host, _} ->
|
||||
State;
|
||||
{hosts, _} ->
|
||||
|
@ -937,8 +937,12 @@ opt_type(modules) ->
|
||||
fun(Mods) ->
|
||||
lists:map(
|
||||
fun({M, A}) when is_atom(M) ->
|
||||
true = is_opt_list(A),
|
||||
{M, A}
|
||||
case is_opt_list(A) of
|
||||
true -> {M, A};
|
||||
false ->
|
||||
?ERROR_MSG("Malformed configuration format of module ~s", [M]),
|
||||
erlang:error(badarg)
|
||||
end
|
||||
end, Mods)
|
||||
end;
|
||||
opt_type(_) -> [modules].
|
||||
|
Loading…
Reference in New Issue
Block a user