mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
Fix read of global ldap_servers option (EJAB-1309)
This commit is contained in:
parent
c1e6c7d821
commit
3ccbf1115c
@ -99,25 +99,31 @@ handle_info(_Info, State) ->
|
|||||||
|
|
||||||
start(Host) ->
|
start(Host) ->
|
||||||
?DEBUG("Starting ~p for ~p.", [?MODULE, Host]),
|
?DEBUG("Starting ~p for ~p.", [?MODULE, Host]),
|
||||||
case ejabberd_config:get_host_option(Host, ldap_servers) of
|
Option = case ejabberd_config:get_host_option(Host, ldap_servers) of
|
||||||
undefined -> check_bad_config(Host);
|
undefined -> check_local_config(Host);
|
||||||
{host, _Host} -> ok;
|
{host, _Host} -> nothing;
|
||||||
_ ->
|
_ ->
|
||||||
Proc = gen_mod:get_module_proc(Host, ?MODULE),
|
{start, Host}
|
||||||
|
end,
|
||||||
|
case Option of
|
||||||
|
nothing -> ok;
|
||||||
|
{start, Host2} ->
|
||||||
|
Proc = gen_mod:get_module_proc(Host2, ?MODULE),
|
||||||
ChildSpec = {
|
ChildSpec = {
|
||||||
Proc, {?MODULE, start_link, [Host]},
|
Proc, {?MODULE, start_link, [Host2]},
|
||||||
transient, 1000, worker, [?MODULE]
|
transient, 1000, worker, [?MODULE]
|
||||||
},
|
},
|
||||||
supervisor:start_child(ejabberd_sup, ChildSpec)
|
supervisor:start_child(ejabberd_sup, ChildSpec)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
check_bad_config(Host) ->
|
check_local_config(Host) ->
|
||||||
case ejabberd_config:get_local_option({ldap_servers, Host}) of
|
case ejabberd_config:get_local_option({ldap_servers, Host}) of
|
||||||
undefined ->
|
undefined ->
|
||||||
?ERROR_MSG("Can't start ~p for host ~p: missing ldap_servers configuration",
|
?ERROR_MSG("Can't start ~p for host ~p: missing ldap_servers "
|
||||||
[?MODULE, Host]),
|
"configuration", [?MODULE, Host]),
|
||||||
{error, bad_config};
|
{error, bad_config};
|
||||||
_ -> ok
|
X when is_list(X)->
|
||||||
|
{start, Host}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
%% @spec (Host) -> term()
|
%% @spec (Host) -> term()
|
||||||
|
Loading…
Reference in New Issue
Block a user