diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index 57e205ca4..f898936f5 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -110,7 +110,17 @@ start(Hosts, Opts) -> [named_table, public, {read_concurrency, true}]), catch ets:new(ejabberd_db_modules, [named_table, public, {read_concurrency, true}]), - set_opts(set_hosts_in_options(Hosts, #state{opts = Opts})), + UnixTime = p1_time_compat:system_time(seconds), + SharedKey = case erlang:get_cookie() of + nocookie -> + str:sha(randoms:get_string()); + Cookie -> + str:sha(misc:atom_to_binary(Cookie)) + end, + State1 = #state{opts = Opts}, + State2 = set_option({node_start, global}, UnixTime, State1), + State3 = set_option({shared_key, global}, SharedKey, State2), + set_opts(set_hosts_in_options(Hosts, State3)), ok. %% @doc Get the filename of the ejabberd configuration file. @@ -1057,12 +1067,7 @@ get_version() -> -spec get_myhosts() -> [binary()]. get_myhosts() -> - case get_option(hosts) of - V when is_list(V) -> - V; - _ -> - [] - end. + get_option(hosts). -spec get_mylang() -> binary(). diff --git a/test/mod_admin_extra_test.exs b/test/mod_admin_extra_test.exs index 38c19dd64..610d354e1 100644 --- a/test/mod_admin_extra_test.exs +++ b/test/mod_admin_extra_test.exs @@ -50,8 +50,8 @@ defmodule EjabberdModAdminExtraTest do :acl.start_link :ejabberd_access_permissions.start_link() :ejabberd_commands.start_link - :ok = :ejabberd_config.start([@domain], []) - :gen_mod.start_link + :ok = :ejabberd_config.start(["domain"], []) + :gen_mod.start_link :mod_admin_extra.start(@domain, []) :sel_application.start_app(:moka) :ejabberd_hooks.start_link