diff --git a/rebar.config b/rebar.config index 5d65052fe..c92b9eb13 100644 --- a/rebar.config +++ b/rebar.config @@ -30,7 +30,6 @@ {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}}, {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.2"}}}, {jose, ".*", {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.8.4"}}}, - {fs, ".*", {git, "https://github.com/synrc/fs", "bed9467"}}, {eimp, ".*", {git, "https://github.com/processone/eimp", {tag, "1.0.3"}}}, {if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.21"}}}}, {if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.22"}}}}, diff --git a/src/ejabberd_pkix.erl b/src/ejabberd_pkix.erl index 217c27d55..596c5e492 100644 --- a/src/ejabberd_pkix.erl +++ b/src/ejabberd_pkix.erl @@ -37,7 +37,6 @@ -include("logger.hrl"). -record(state, {validate = true :: boolean(), - notify = false :: boolean(), paths = [] :: [file:filename()], certs = #{} :: map(), graph :: digraph:graph(), @@ -197,7 +196,6 @@ opt_type(_) -> %%% gen_server callbacks %%%=================================================================== init([]) -> - Notify = start_fs(), process_flag(trap_exit, true), ets:new(?MODULE, [named_table, public]), ejabberd_hooks:add(route_registered, ?MODULE, route_registered, 50), @@ -214,7 +212,7 @@ init([]) -> end, G = digraph:new([acyclic]), init_cache(), - State = #state{validate = Validate, notify = Notify, graph = G}, + State = #state{validate = Validate, graph = G}, case filelib:ensure_dir(filename:join(certs_dir(), "foo")) of ok -> clean_dir(certs_dir()), @@ -279,20 +277,6 @@ handle_call(_Request, _From, State) -> handle_cast(_Msg, State) -> {noreply, State}. -handle_info({_, {fs, file_event}, {File, Events}}, State) -> - ?DEBUG("got FS events for ~s: ~p", [File, Events]), - Path = iolist_to_binary(File), - case lists:member(modified, Events) of - true -> - case lists:member(Path, State#state.paths) of - true -> - handle_cast(config_reloaded, State); - false -> - {noreply, State} - end; - false -> - {noreply, State} - end; handle_info(_Info, State) -> ?WARNING_MSG("unexpected info: ~p", [_Info]), {noreply, State}. @@ -419,7 +403,6 @@ build_chain_and_check(State) -> ?DEBUG("Validating certificates", []), Errors = validate(CertPaths, State#state.validate), ?DEBUG("Subscribing to file events", []), - subscribe(State), lists:foreach( fun({Cert, Why}) -> Path = maps:get(Cert, State#state.certs), @@ -854,40 +837,6 @@ short_name_hash(_) -> "". -endif. --spec subscribe(state()) -> ok. -subscribe(#state{notify = true} = State) -> - lists:foreach( - fun(Path) -> - Dir = filename:dirname(Path), - Name = list_to_atom(integer_to_list(erlang:phash2(Dir))), - case fs:start_link(Name, Dir) of - {ok, _} -> - ?DEBUG("Subscribed to FS events from ~s", [Dir]), - fs:subscribe(Name); - {error, _} -> - ok - end - end, State#state.paths); -subscribe(_) -> - ok. - --spec start_fs() -> boolean(). -start_fs() -> - application:load(fs), - application:set_env(fs, backwards_compatible, false), - case application:ensure_all_started(fs) of - {ok, _} -> true; - {error, {already_loaded, _}} -> true; - {error, Reason} -> - ?ERROR_MSG("Failed to load 'fs' Erlang application: ~p; " - "certificates change detection will be disabled. " - "You should now manually run `ejabberdctl " - "reload_config` whenever certificates are changed " - "on disc", - [Reason]), - false - end. - wildcard(Path) when is_binary(Path) -> wildcard(binary_to_list(Path)); wildcard(Path) ->