mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
Normalize hostname when processing host_config
This commit is contained in:
parent
157e9c04f6
commit
3b1c0dc27f
@ -500,7 +500,8 @@ get_config_option_key(Name, Val) ->
|
|||||||
|
|
||||||
maps_to_lists(IMap) ->
|
maps_to_lists(IMap) ->
|
||||||
maps:fold(fun(Name, Map, Res) when Name == host_config orelse Name == append_host_config ->
|
maps:fold(fun(Name, Map, Res) when Name == host_config orelse Name == append_host_config ->
|
||||||
[{Name, [{Host, maps_to_lists(SMap)} || {Host,SMap} <- maps:values(Map)]} | Res];
|
[{Name, [{jid:nameprep(Host), maps_to_lists(SMap)} ||
|
||||||
|
{Host,SMap} <- maps:values(Map)]} | Res];
|
||||||
(Name, Map, Res) when is_map(Map) ->
|
(Name, Map, Res) when is_map(Map) ->
|
||||||
[{Name, maps:values(Map)} | Res];
|
[{Name, maps:values(Map)} | Res];
|
||||||
(Name, Val, Res) ->
|
(Name, Val, Res) ->
|
||||||
@ -513,8 +514,9 @@ merge_configs(Terms, ResMap) ->
|
|||||||
New = lists:foldl(fun(SVal, OMap) ->
|
New = lists:foldl(fun(SVal, OMap) ->
|
||||||
NVal = if Name == host_config orelse Name == append_host_config ->
|
NVal = if Name == host_config orelse Name == append_host_config ->
|
||||||
{Host, Opts} = SVal,
|
{Host, Opts} = SVal,
|
||||||
{_, SubMap} = maps:get(Host, OMap, {Host, #{}}),
|
HostNP = jid:nameprep(Host),
|
||||||
{Host, merge_configs(Opts, SubMap)};
|
{_, SubMap} = maps:get(HostNP, OMap, {HostNP, #{}}),
|
||||||
|
{HostNP, merge_configs(Opts, SubMap)};
|
||||||
true ->
|
true ->
|
||||||
SVal
|
SVal
|
||||||
end,
|
end,
|
||||||
|
Loading…
Reference in New Issue
Block a user