diff --git a/ejabberd_auth_http/src/ejabberd_auth_http.erl b/ejabberd_auth_http/src/ejabberd_auth_http.erl index ff483c6..2d2eb8b 100644 --- a/ejabberd_auth_http/src/ejabberd_auth_http.erl +++ b/ejabberd_auth_http/src/ejabberd_auth_http.erl @@ -136,7 +136,7 @@ get_password(_, _) -> {cache, error}. -spec get_password_s(binary(), binary()) -> {cache, error}. -get_password_s(User, Server) -> +get_password_s(_User, _Server) -> {cache, error}. -spec user_exists(binary(), binary()) -> {ets_cache:tag(), boolean()}. @@ -161,7 +161,7 @@ remove_user(LUser, LServer, Password) -> {error, not_allowed}; {ok, true} -> remove_user_req(LUser, LServer, <<"">>, <<"remove_user">>); - {error, Error} -> + {error, _Error} -> {error, db_failure} end end. @@ -195,9 +195,9 @@ make_req(Method, Path, LUser, LServer, Password) -> false -> <<"/">> end, BasicAuth64 = base64:encode(BasicAuth), - LUserE = list_to_binary(http_uri:encode(binary_to_list(LUser))), - LServerE = list_to_binary(http_uri:encode(binary_to_list(LServer))), - PasswordE = list_to_binary(http_uri:encode(binary_to_list(Password))), + LUserE = list_to_binary(misc:uri_parse(binary_to_list(LUser))), + LServerE = list_to_binary(misc:uri_parse(binary_to_list(LServer))), + PasswordE = list_to_binary(misc:uri_parse(binary_to_list(Password))), Query = <<"user=", LUserE/binary, "&server=", LServerE/binary, "&pass=", PasswordE/binary>>, Header = [{<<"Authorization">>, <<"Basic ", BasicAuth64/binary>>}], ContentType = {<<"Content-Type">>, <<"application/x-www-form-urlencoded">>}, diff --git a/ejabberd_auth_http/src/scram2.erl b/ejabberd_auth_http/src/scram2.erl index ffd9c80..ed09306 100644 --- a/ejabberd_auth_http/src/scram2.erl +++ b/ejabberd_auth_http/src/scram2.erl @@ -61,7 +61,7 @@ -spec salted_password(binary(), binary(), non_neg_integer()) -> binary(). salted_password(Password, Salt, IterationCount) -> - hi(jlib:resourceprep(Password), Salt, IterationCount). + hi(jid:resourceprep(Password), Salt, IterationCount). -spec client_key(binary()) -> binary(). client_key(SaltedPassword) -> @@ -106,7 +106,7 @@ hi_round(Password, UPrev, IterationCount) -> enabled(Host) -> - case ejabberd_config:get_option({auth_opts, Host}, fun(V) -> V end) of + case ejabberd_config:get_option({auth_opts, Host}) of undefined -> false; AuthOpts -> @@ -116,7 +116,7 @@ enabled(Host) -> iterations() -> ?SCRAM_DEFAULT_ITERATION_COUNT. iterations(Host) -> - case ejabberd_config:get_option({auth_opts, Host}, fun(V) -> V end) of + case ejabberd_config:get_option({auth_opts, Host}) of undefined -> iterations(); AuthOpts -> @@ -179,7 +179,7 @@ scram_to_tuple(Scram) -> -spec check_digest(scram(), binary(), fun(), binary()) -> boolean(). check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) -> - Passwd = jlib:decode_base64(StoredKey), + Passwd = base64:decode(StoredKey), DigRes = if Digest /= <<"">> -> Digest == DigestGen(Passwd); true -> false @@ -188,11 +188,5 @@ check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) -> true -> (Passwd == Password) and (Password /= <<"">>) end. - --ifdef(no_crypto_hmac). crypto_hmac(sha, Key, Data) -> - crypto:sha_mac(Key, Data). --else. -crypto_hmac(sha, Key, Data) -> - crypto:hmac(sha, Key, Data). --endif. + misc:crypto_hmac(sha, Key, Data). diff --git a/ejabberd_observer_cli/src/ejabberd_observer_cli_users.erl b/ejabberd_observer_cli/src/ejabberd_observer_cli_users.erl index 6ee0d63..7976dfa 100644 --- a/ejabberd_observer_cli/src/ejabberd_observer_cli_users.erl +++ b/ejabberd_observer_cli/src/ejabberd_observer_cli_users.erl @@ -51,7 +51,7 @@ sheet_body(PrevState) -> Host, length(ejabberd_sm:get_user_resources(Username, Host)), length(mod_roster:get_roster(Username, Host)), - mod_offline:get_queue_length(Username, Host), + mod_offline:count_offline_messages(Username, Host), get_last_activity(Username, Host) ] end diff --git a/mod_grafite/src/mod_grafite.erl b/mod_grafite/src/mod_grafite.erl index 21c15cd..b54333b 100644 --- a/mod_grafite/src/mod_grafite.erl +++ b/mod_grafite/src/mod_grafite.erl @@ -23,7 +23,7 @@ -define(GLOBAL_HOOKS, [component_connected, component_disconnected]). --export([start/2, stop/1, mod_opt_type/1, +-export([start/2, stop/1, mod_opt_type/1, mod_options/1, depends/2, mod_doc/0, udp_loop_start/1, push/2]). -export([offline_message_hook/3, @@ -50,9 +50,9 @@ start(Host, Opts) -> || Hook <- ?HOOKS], [ejabberd_hooks:add(Hook, ?MODULE, Hook, 18) || Hook <- ?GLOBAL_HOOKS], - StatsDH = gen_mod:get_opt(statsdhost, Opts, fun(X) -> X end, "localhost"), + StatsDH = gen_mod:get_opt(statsdhost, Opts), {ok, StatsDHost} = getaddrs(StatsDH), - StatsDPort = gen_mod:get_opt(statsdport, Opts, fun(X) -> X end, 8125), + StatsDPort = gen_mod:get_opt(statsdport, Opts), register(?PROCNAME, spawn(?MODULE, udp_loop_start, [#state{host = StatsDHost, port = StatsDPort}])), ok. @@ -113,7 +113,7 @@ push(Host, Probe) -> whereis(?PROCNAME) ! {send, Payload}. encode_metrics(Host, Probe) -> - [_, NodeId] = str:tokens(jlib:atom_to_binary(node()), <<"@">>), + [_, NodeId] = str:tokens(misc:atom_to_binary(node()), <<"@">>), [Node | _] = str:tokens(NodeId, <<".">>), Data = case Probe of {Key, Val} -> @@ -198,7 +198,13 @@ timestamp() -> %% mod Options %%==================================================================== -mod_opt_type(statsdhost) -> fun(X) -> X end; -mod_opt_type(statsdport) -> fun(X) when is_integer(X) -> X end; +mod_opt_type(statsdhost) -> + econf:string(); +mod_opt_type(statsdport) -> + econf:pos_int(); mod_opt_type(_) -> [statsdhost, statsdport]. + +mod_options(_Host) -> + [{statsdhost, "localhost"}, + {statsdport, 8125}]. diff --git a/mod_logsession/src/mod_logsession.erl b/mod_logsession/src/mod_logsession.erl index b9ea83c..169fc8b 100644 --- a/mod_logsession/src/mod_logsession.erl +++ b/mod_logsession/src/mod_logsession.erl @@ -64,6 +64,7 @@ start(Host, Opts) -> stop(Host) -> ejabberd_hooks:delete(reopen_log_hook, Host, ?MODULE, reopen_log, 50), ejabberd_hooks:delete(forbidden_session_hook, Host, ?MODULE, forbidden, 50), + ejabberd_hooks:delete(c2s_auth_result, Host, ?MODULE, failed_auth, 50), ejabberd_commands:unregister_commands(commands()), Proc = get_process_name(Host), exit(whereis(Proc), stop), diff --git a/mod_message_log/src/mod_message_log.erl b/mod_message_log/src/mod_message_log.erl index db84d67..4e13e2a 100644 --- a/mod_message_log/src/mod_message_log.erl +++ b/mod_message_log/src/mod_message_log.erl @@ -131,7 +131,7 @@ init([_Host, Opts]) -> {ok, #state{filename = Filename, iodevice = IoDevice}}. -spec handle_call(_, {pid(), _}, state()) -> {noreply, state()}. -handle_call(get_filename, From, State) -> +handle_call(get_filename, _From, State) -> {reply, {filename, State#state.filename}, State}; handle_call(_Request, _From, State) -> {noreply, State}. diff --git a/mod_post_log/src/mod_post_log.erl b/mod_post_log/src/mod_post_log.erl index d723aab..ef4c532 100644 --- a/mod_post_log/src/mod_post_log.erl +++ b/mod_post_log/src/mod_post_log.erl @@ -133,7 +133,7 @@ report_error(ReportArgs) -> ok = error_logger:error_report([ mod_post_log_cannot_post | ReportArgs ]). format_jid(JID) -> - binary_to_list(jid:to_string(JID)). + binary_to_list(jid:encode(JID)). %% Erlang now()-style timestamps are in UTC by definition, and we are %% assuming ISO 8601 dates should be printed in UTC as well, so no diff --git a/mod_pottymouth/src/mod_pottymouth.erl b/mod_pottymouth/src/mod_pottymouth.erl index 4a5c343..99dcbeb 100644 --- a/mod_pottymouth/src/mod_pottymouth.erl +++ b/mod_pottymouth/src/mod_pottymouth.erl @@ -70,7 +70,7 @@ start(_Host, Opts) -> stop(Host) -> Blacklists = gen_mod:get_module_opt(Host, ?MODULE, blacklists), - lists:map(fun banword_gen_server:stop/1, Blacklists), + lists:map(fun banword_gen_server:stop/0, Blacklists), CharMaps = gen_mod:get_module_opt(Host, ?MODULE, charmaps), lists:map(fun normalize_leet_gen_server:stop/1, CharMaps), ejabberd_hooks:delete(filter_packet, global, ?MODULE, on_filter_packet, 0), diff --git a/mod_spam_filter/src/mod_spam_filter.erl b/mod_spam_filter/src/mod_spam_filter.erl index f40cf16..013426c 100644 --- a/mod_spam_filter/src/mod_spam_filter.erl +++ b/mod_spam_filter/src/mod_spam_filter.erl @@ -606,7 +606,7 @@ get_proc_name(Host) -> -spec get_spam_filter_hosts() -> [binary()]. get_spam_filter_hosts() -> - [H || H <- ejabberd_config:get_myhosts(), gen_mod:is_loaded(H, ?MODULE)]. + [H || H <- ejabberd_option:hosts(), gen_mod:is_loaded(H, ?MODULE)]. -spec expand_host(binary() | none, binary()) -> binary() | none. expand_host(none, _Host) ->