From 3b1c0dc27f0cfd5c30d165a7095d75e2dffedc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chmielowski?= Date: Thu, 6 Dec 2018 15:12:23 +0100 Subject: [PATCH] Normalize hostname when processing host_config --- src/ejabberd_config.erl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index 48fdcefbc..90bbed179 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -500,7 +500,8 @@ get_config_option_key(Name, Val) -> maps_to_lists(IMap) -> 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, maps:values(Map)} | Res]; (Name, Val, Res) -> @@ -513,8 +514,9 @@ merge_configs(Terms, ResMap) -> New = lists:foldl(fun(SVal, OMap) -> NVal = if Name == host_config orelse Name == append_host_config -> {Host, Opts} = SVal, - {_, SubMap} = maps:get(Host, OMap, {Host, #{}}), - {Host, merge_configs(Opts, SubMap)}; + HostNP = jid:nameprep(Host), + {_, SubMap} = maps:get(HostNP, OMap, {HostNP, #{}}), + {HostNP, merge_configs(Opts, SubMap)}; true -> SVal end,