Fix compilation and Xref warnings
This commit is contained in:
parent
b96efd7df2
commit
6be46dacc9
|
@ -136,7 +136,7 @@ get_password(_, _) ->
|
||||||
{cache, error}.
|
{cache, error}.
|
||||||
|
|
||||||
-spec get_password_s(binary(), binary()) -> {cache, error}.
|
-spec get_password_s(binary(), binary()) -> {cache, error}.
|
||||||
get_password_s(User, Server) ->
|
get_password_s(_User, _Server) ->
|
||||||
{cache, error}.
|
{cache, error}.
|
||||||
|
|
||||||
-spec user_exists(binary(), binary()) -> {ets_cache:tag(), boolean()}.
|
-spec user_exists(binary(), binary()) -> {ets_cache:tag(), boolean()}.
|
||||||
|
@ -161,7 +161,7 @@ remove_user(LUser, LServer, Password) ->
|
||||||
{error, not_allowed};
|
{error, not_allowed};
|
||||||
{ok, true} ->
|
{ok, true} ->
|
||||||
remove_user_req(LUser, LServer, <<"">>, <<"remove_user">>);
|
remove_user_req(LUser, LServer, <<"">>, <<"remove_user">>);
|
||||||
{error, Error} ->
|
{error, _Error} ->
|
||||||
{error, db_failure}
|
{error, db_failure}
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
@ -195,9 +195,9 @@ make_req(Method, Path, LUser, LServer, Password) ->
|
||||||
false -> <<"/">>
|
false -> <<"/">>
|
||||||
end,
|
end,
|
||||||
BasicAuth64 = base64:encode(BasicAuth),
|
BasicAuth64 = base64:encode(BasicAuth),
|
||||||
LUserE = list_to_binary(http_uri:encode(binary_to_list(LUser))),
|
LUserE = list_to_binary(misc:uri_parse(binary_to_list(LUser))),
|
||||||
LServerE = list_to_binary(http_uri:encode(binary_to_list(LServer))),
|
LServerE = list_to_binary(misc:uri_parse(binary_to_list(LServer))),
|
||||||
PasswordE = list_to_binary(http_uri:encode(binary_to_list(Password))),
|
PasswordE = list_to_binary(misc:uri_parse(binary_to_list(Password))),
|
||||||
Query = <<"user=", LUserE/binary, "&server=", LServerE/binary, "&pass=", PasswordE/binary>>,
|
Query = <<"user=", LUserE/binary, "&server=", LServerE/binary, "&pass=", PasswordE/binary>>,
|
||||||
Header = [{<<"Authorization">>, <<"Basic ", BasicAuth64/binary>>}],
|
Header = [{<<"Authorization">>, <<"Basic ", BasicAuth64/binary>>}],
|
||||||
ContentType = {<<"Content-Type">>, <<"application/x-www-form-urlencoded">>},
|
ContentType = {<<"Content-Type">>, <<"application/x-www-form-urlencoded">>},
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
|
|
||||||
-spec salted_password(binary(), binary(), non_neg_integer()) -> binary().
|
-spec salted_password(binary(), binary(), non_neg_integer()) -> binary().
|
||||||
salted_password(Password, Salt, IterationCount) ->
|
salted_password(Password, Salt, IterationCount) ->
|
||||||
hi(jlib:resourceprep(Password), Salt, IterationCount).
|
hi(jid:resourceprep(Password), Salt, IterationCount).
|
||||||
|
|
||||||
-spec client_key(binary()) -> binary().
|
-spec client_key(binary()) -> binary().
|
||||||
client_key(SaltedPassword) ->
|
client_key(SaltedPassword) ->
|
||||||
|
@ -106,7 +106,7 @@ hi_round(Password, UPrev, IterationCount) ->
|
||||||
|
|
||||||
|
|
||||||
enabled(Host) ->
|
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 ->
|
undefined ->
|
||||||
false;
|
false;
|
||||||
AuthOpts ->
|
AuthOpts ->
|
||||||
|
@ -116,7 +116,7 @@ enabled(Host) ->
|
||||||
iterations() -> ?SCRAM_DEFAULT_ITERATION_COUNT.
|
iterations() -> ?SCRAM_DEFAULT_ITERATION_COUNT.
|
||||||
|
|
||||||
iterations(Host) ->
|
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 ->
|
undefined ->
|
||||||
iterations();
|
iterations();
|
||||||
AuthOpts ->
|
AuthOpts ->
|
||||||
|
@ -179,7 +179,7 @@ scram_to_tuple(Scram) ->
|
||||||
|
|
||||||
-spec check_digest(scram(), binary(), fun(), binary()) -> boolean().
|
-spec check_digest(scram(), binary(), fun(), binary()) -> boolean().
|
||||||
check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) ->
|
check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) ->
|
||||||
Passwd = jlib:decode_base64(StoredKey),
|
Passwd = base64:decode(StoredKey),
|
||||||
DigRes = if Digest /= <<"">> ->
|
DigRes = if Digest /= <<"">> ->
|
||||||
Digest == DigestGen(Passwd);
|
Digest == DigestGen(Passwd);
|
||||||
true -> false
|
true -> false
|
||||||
|
@ -188,11 +188,5 @@ check_digest(#scram{storedkey = StoredKey}, Digest, DigestGen, Password) ->
|
||||||
true -> (Passwd == Password) and (Password /= <<"">>)
|
true -> (Passwd == Password) and (Password /= <<"">>)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
-ifdef(no_crypto_hmac).
|
|
||||||
crypto_hmac(sha, Key, Data) ->
|
crypto_hmac(sha, Key, Data) ->
|
||||||
crypto:sha_mac(Key, Data).
|
misc:crypto_hmac(sha, Key, Data).
|
||||||
-else.
|
|
||||||
crypto_hmac(sha, Key, Data) ->
|
|
||||||
crypto:hmac(sha, Key, Data).
|
|
||||||
-endif.
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ sheet_body(PrevState) ->
|
||||||
Host,
|
Host,
|
||||||
length(ejabberd_sm:get_user_resources(Username, Host)),
|
length(ejabberd_sm:get_user_resources(Username, Host)),
|
||||||
length(mod_roster:get_roster(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)
|
get_last_activity(Username, Host)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
-define(GLOBAL_HOOKS, [component_connected, component_disconnected]).
|
-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]).
|
depends/2, mod_doc/0, udp_loop_start/1, push/2]).
|
||||||
|
|
||||||
-export([offline_message_hook/3,
|
-export([offline_message_hook/3,
|
||||||
|
@ -50,9 +50,9 @@ start(Host, Opts) ->
|
||||||
|| Hook <- ?HOOKS],
|
|| Hook <- ?HOOKS],
|
||||||
[ejabberd_hooks:add(Hook, ?MODULE, Hook, 18)
|
[ejabberd_hooks:add(Hook, ?MODULE, Hook, 18)
|
||||||
|| Hook <- ?GLOBAL_HOOKS],
|
|| 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),
|
{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}])),
|
register(?PROCNAME, spawn(?MODULE, udp_loop_start, [#state{host = StatsDHost, port = StatsDPort}])),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ push(Host, Probe) ->
|
||||||
whereis(?PROCNAME) ! {send, Payload}.
|
whereis(?PROCNAME) ! {send, Payload}.
|
||||||
|
|
||||||
encode_metrics(Host, Probe) ->
|
encode_metrics(Host, Probe) ->
|
||||||
[_, NodeId] = str:tokens(jlib:atom_to_binary(node()), <<"@">>),
|
[_, NodeId] = str:tokens(misc:atom_to_binary(node()), <<"@">>),
|
||||||
[Node | _] = str:tokens(NodeId, <<".">>),
|
[Node | _] = str:tokens(NodeId, <<".">>),
|
||||||
Data = case Probe of
|
Data = case Probe of
|
||||||
{Key, Val} ->
|
{Key, Val} ->
|
||||||
|
@ -198,7 +198,13 @@ timestamp() ->
|
||||||
%% mod Options
|
%% mod Options
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
|
|
||||||
mod_opt_type(statsdhost) -> fun(X) -> X end;
|
mod_opt_type(statsdhost) ->
|
||||||
mod_opt_type(statsdport) -> fun(X) when is_integer(X) -> X end;
|
econf:string();
|
||||||
|
mod_opt_type(statsdport) ->
|
||||||
|
econf:pos_int();
|
||||||
mod_opt_type(_) ->
|
mod_opt_type(_) ->
|
||||||
[statsdhost, statsdport].
|
[statsdhost, statsdport].
|
||||||
|
|
||||||
|
mod_options(_Host) ->
|
||||||
|
[{statsdhost, "localhost"},
|
||||||
|
{statsdport, 8125}].
|
||||||
|
|
|
@ -64,6 +64,7 @@ start(Host, Opts) ->
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
ejabberd_hooks:delete(reopen_log_hook, Host, ?MODULE, reopen_log, 50),
|
ejabberd_hooks:delete(reopen_log_hook, Host, ?MODULE, reopen_log, 50),
|
||||||
ejabberd_hooks:delete(forbidden_session_hook, Host, ?MODULE, forbidden, 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()),
|
ejabberd_commands:unregister_commands(commands()),
|
||||||
Proc = get_process_name(Host),
|
Proc = get_process_name(Host),
|
||||||
exit(whereis(Proc), stop),
|
exit(whereis(Proc), stop),
|
||||||
|
|
|
@ -131,7 +131,7 @@ init([_Host, Opts]) ->
|
||||||
{ok, #state{filename = Filename, iodevice = IoDevice}}.
|
{ok, #state{filename = Filename, iodevice = IoDevice}}.
|
||||||
|
|
||||||
-spec handle_call(_, {pid(), _}, state()) -> {noreply, state()}.
|
-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};
|
{reply, {filename, State#state.filename}, State};
|
||||||
handle_call(_Request, _From, State) ->
|
handle_call(_Request, _From, State) ->
|
||||||
{noreply, State}.
|
{noreply, State}.
|
||||||
|
|
|
@ -133,7 +133,7 @@ report_error(ReportArgs) ->
|
||||||
ok = error_logger:error_report([ mod_post_log_cannot_post | ReportArgs ]).
|
ok = error_logger:error_report([ mod_post_log_cannot_post | ReportArgs ]).
|
||||||
|
|
||||||
format_jid(JID) ->
|
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
|
%% 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
|
%% assuming ISO 8601 dates should be printed in UTC as well, so no
|
||||||
|
|
|
@ -70,7 +70,7 @@ start(_Host, Opts) ->
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
Blacklists = gen_mod:get_module_opt(Host, ?MODULE, blacklists),
|
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),
|
CharMaps = gen_mod:get_module_opt(Host, ?MODULE, charmaps),
|
||||||
lists:map(fun normalize_leet_gen_server:stop/1, CharMaps),
|
lists:map(fun normalize_leet_gen_server:stop/1, CharMaps),
|
||||||
ejabberd_hooks:delete(filter_packet, global, ?MODULE, on_filter_packet, 0),
|
ejabberd_hooks:delete(filter_packet, global, ?MODULE, on_filter_packet, 0),
|
||||||
|
|
|
@ -606,7 +606,7 @@ get_proc_name(Host) ->
|
||||||
|
|
||||||
-spec get_spam_filter_hosts() -> [binary()].
|
-spec get_spam_filter_hosts() -> [binary()].
|
||||||
get_spam_filter_hosts() ->
|
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.
|
-spec expand_host(binary() | none, binary()) -> binary() | none.
|
||||||
expand_host(none, _Host) ->
|
expand_host(none, _Host) ->
|
||||||
|
|
Loading…
Reference in New Issue