aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-07-12 11:55:36 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-07-12 11:55:36 +0300
commit6f5d99275b2c41738647dd46659ad5fd0a424827 (patch)
tree55d12cb3d244e4363dfb2f80df1d09bb98269d40 /src
parentImprove previous commit (diff)
Process unexpected messages uniformly
Diffstat (limited to 'src')
-rw-r--r--src/ejabberd_access_permissions.erl11
-rw-r--r--src/ejabberd_acme.erl5
-rw-r--r--src/ejabberd_admin.erl12
-rw-r--r--src/ejabberd_auth.erl9
-rw-r--r--src/ejabberd_auth_ldap.erl13
-rw-r--r--src/ejabberd_c2s.erl18
-rw-r--r--src/ejabberd_captcha.erl13
-rw-r--r--src/ejabberd_cluster.erl12
-rw-r--r--src/ejabberd_commands.erl12
-rw-r--r--src/ejabberd_ctl.erl12
-rw-r--r--src/ejabberd_local.erl9
-rw-r--r--src/ejabberd_mnesia.erl9
-rw-r--r--src/ejabberd_oauth.erl13
-rw-r--r--src/ejabberd_riak.erl13
-rw-r--r--src/ejabberd_router_mnesia.erl9
-rw-r--r--src/ejabberd_router_multicast.erl12
-rw-r--r--src/ejabberd_router_redis.erl9
-rw-r--r--src/ejabberd_sm.erl9
-rw-r--r--src/ejabberd_sm_mnesia.erl13
-rw-r--r--src/ejabberd_sm_redis.erl11
-rw-r--r--src/ext_mod.erl12
-rw-r--r--src/mod_announce.erl3
-rw-r--r--src/mod_bosh_mnesia.erl13
-rw-r--r--src/mod_bosh_redis.erl13
-rw-r--r--src/mod_caps.erl9
-rw-r--r--src/mod_fail2ban.erl10
-rw-r--r--src/mod_http_fileserver.erl8
-rw-r--r--src/mod_http_upload.erl6
-rw-r--r--src/mod_mix.erl4
-rw-r--r--src/mod_mqtt.erl12
-rw-r--r--src/mod_muc_mnesia.erl11
-rw-r--r--src/mod_ping.erl9
-rw-r--r--src/mod_proxy65_mnesia.erl12
-rw-r--r--src/mod_proxy65_service.erl9
-rw-r--r--src/mod_shared_roster_ldap.erl13
-rw-r--r--src/mod_sip_registrar.erl13
-rw-r--r--src/mod_vcard_ldap.erl12
-rw-r--r--src/translate.erl12
38 files changed, 245 insertions, 160 deletions
diff --git a/src/ejabberd_access_permissions.erl b/src/ejabberd_access_permissions.erl
index 2f63cb576..673758fa4 100644
--- a/src/ejabberd_access_permissions.erl
+++ b/src/ejabberd_access_permissions.erl
@@ -125,16 +125,19 @@ handle_call({can_access, Cmd, CallerInfo}, _From, State) ->
handle_call(show_current_definitions, _From, State) ->
{State2, Defs} = get_definitions(State),
{reply, Defs, State2};
-handle_call(_Request, _From, State) ->
- {reply, ok, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-spec handle_cast(invalidate | term(), state()) -> {noreply, state()}.
handle_cast(invalidate, State) ->
{noreply, State#state{definitions = none}};
-handle_cast(_Request, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_acme.erl b/src/ejabberd_acme.erl
index 8cb1b2625..b080474d8 100644
--- a/src/ejabberd_acme.erl
+++ b/src/ejabberd_acme.erl
@@ -50,8 +50,9 @@ init([]) ->
{stop, Why}
end.
-handle_call(_Request, _From, State) ->
- {stop, {unexpected_call, _Request, _From}, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast(_Msg, State) ->
?WARNING_MSG("Unexpected cast: ~p", [_Msg]),
diff --git a/src/ejabberd_admin.erl b/src/ejabberd_admin.erl
index bde2cde8f..1136f12b3 100644
--- a/src/ejabberd_admin.erl
+++ b/src/ejabberd_admin.erl
@@ -77,14 +77,16 @@ init([]) ->
ejabberd_commands:register_commands(get_commands_spec()),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_auth.erl b/src/ejabberd_auth.erl
index c5fda7d34..f97a40264 100644
--- a/src/ejabberd_auth.erl
+++ b/src/ejabberd_auth.erl
@@ -117,9 +117,9 @@ init([]) ->
init_cache(HostModules),
{ok, #state{host_modules = HostModules}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast({host_up, Host}, #state{host_modules = HostModules} = State) ->
Modules = auth_modules(Host),
@@ -150,7 +150,8 @@ handle_cast(Msg, State) ->
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, State) ->
diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl
index 3f5429395..4dfebddcd 100644
--- a/src/ejabberd_auth_ldap.erl
+++ b/src/ejabberd_auth_ldap.erl
@@ -61,11 +61,15 @@
dn_filter :: binary() | undefined,
dn_filter_attrs = [] :: [binary()]}).
-handle_cast(_Request, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
code_change(_OldVsn, State, _Extra) -> {ok, State}.
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
-define(LDAP_SEARCH_TIMEOUT, 5).
@@ -225,8 +229,9 @@ handle_call(get_state, _From, State) ->
{reply, {ok, State}, State};
handle_call(stop, _From, State) ->
{stop, normal, ok, State};
-handle_call(_Request, _From, State) ->
- {reply, bad_request, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
find_user_dn(User, State) ->
ResAttrs = result_attrs(State),
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl
index 94d0e22b7..f0c609eb7 100644
--- a/src/ejabberd_c2s.erl
+++ b/src/ejabberd_c2s.erl
@@ -38,9 +38,9 @@
handle_auth_success/4, handle_auth_failure/4, handle_send/3,
handle_recv/3, handle_cdata/2, handle_unbinded_packet/2]).
%% Hooks
--export([handle_unexpected_cast/2, process_auth_result/3,
- reject_unauthenticated_packet/2, process_closed/2,
- process_terminated/2, process_info/2]).
+-export([handle_unexpected_cast/2, handle_unexpected_call/3,
+ process_auth_result/3, reject_unauthenticated_packet/2,
+ process_closed/2, process_terminated/2, process_info/2]).
%% API
-export([get_presence/1, set_presence/2, resend_presence/1, resend_presence/2,
open_session/1, call/3, cast/2, send/2, close/1, close/2, stop/1,
@@ -158,7 +158,9 @@ host_up(Host) ->
ejabberd_hooks:add(c2s_auth_result, Host, ?MODULE,
process_auth_result, 100),
ejabberd_hooks:add(c2s_handle_cast, Host, ?MODULE,
- handle_unexpected_cast, 100).
+ handle_unexpected_cast, 100),
+ ejabberd_hooks:add(c2s_handle_call, Host, ?MODULE,
+ handle_unexpected_call, 100).
-spec host_down(binary()) -> ok.
host_down(Host) ->
@@ -172,7 +174,9 @@ host_down(Host) ->
ejabberd_hooks:delete(c2s_auth_result, Host, ?MODULE,
process_auth_result, 100),
ejabberd_hooks:delete(c2s_handle_cast, Host, ?MODULE,
- handle_unexpected_cast, 100).
+ handle_unexpected_cast, 100),
+ ejabberd_hooks:delete(c2s_handle_call, Host, ?MODULE,
+ handle_unexpected_call, 100).
%% Copies content of one c2s state to another.
%% This is needed for session migration from one pid to another.
@@ -249,6 +253,10 @@ process_info(State, Info) ->
?WARNING_MSG("Unexpected info: ~p", [Info]),
State.
+handle_unexpected_call(State, From, Msg) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Msg]),
+ State.
+
handle_unexpected_cast(State, Msg) ->
?WARNING_MSG("Unexpected cast: ~p", [Msg]),
State.
diff --git a/src/ejabberd_captcha.erl b/src/ejabberd_captcha.erl
index 02cf2659a..720f375c5 100644
--- a/src/ejabberd_captcha.erl
+++ b/src/ejabberd_captcha.erl
@@ -341,10 +341,13 @@ handle_call(config_reloaded, _From, #state{enabled = Enabled} = State) ->
State
end,
{reply, ok, State1};
-handle_call(_Request, _From, State) ->
- {reply, bad_request, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
handle_info({remove_id, Id}, State) ->
?DEBUG("CAPTCHA ~p timed out", [Id]),
@@ -355,7 +358,9 @@ handle_info({remove_id, Id}, State) ->
_ -> ok
end,
{noreply, State};
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
terminate(_Reason, #state{enabled = Enabled}) ->
if Enabled -> unregister_handlers();
diff --git a/src/ejabberd_cluster.erl b/src/ejabberd_cluster.erl
index e2b02f7f8..888420f34 100644
--- a/src/ejabberd_cluster.erl
+++ b/src/ejabberd_cluster.erl
@@ -167,11 +167,12 @@ init([]) ->
{stop, Reason}
end.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({node_up, Node}, State) ->
@@ -180,7 +181,8 @@ handle_info({node_up, Node}, State) ->
handle_info({node_down, Node}, State) ->
?INFO_MSG("Node ~s has left", [Node]),
{noreply, State};
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl
index 4c6b3b695..b3c3ef4d5 100644
--- a/src/ejabberd_commands.erl
+++ b/src/ejabberd_commands.erl
@@ -292,14 +292,16 @@ init([]) ->
register_commands(get_commands_spec()),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl
index c9dfff9c6..45169cdcf 100644
--- a/src/ejabberd_ctl.erl
+++ b/src/ejabberd_ctl.erl
@@ -114,14 +114,16 @@ init([]) ->
ets:new(ejabberd_ctl_host_cmds, [named_table, set, public]),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_local.erl b/src/ejabberd_local.erl
index 91a9264a5..6e68ef312 100644
--- a/src/ejabberd_local.erl
+++ b/src/ejabberd_local.erl
@@ -122,10 +122,13 @@ init([]) ->
update_table(),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok, {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
handle_info({route, Packet}, State) ->
route(Packet),
diff --git a/src/ejabberd_mnesia.erl b/src/ejabberd_mnesia.erl
index 3df981124..3cf2e460a 100644
--- a/src/ejabberd_mnesia.erl
+++ b/src/ejabberd_mnesia.erl
@@ -97,13 +97,16 @@ handle_call({create, Module, Name, TabDef}, _From, State) ->
Tables = maps:put(Name, {TabDef, Result}, State#state.tables),
{reply, Result, State#state{tables = Tables}}
end;
-handle_call(_Request, _From, State) ->
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_oauth.erl b/src/ejabberd_oauth.erl
index 55a414f15..28f9b0de0 100644
--- a/src/ejabberd_oauth.erl
+++ b/src/ejabberd_oauth.erl
@@ -154,10 +154,13 @@ init([]) ->
erlang:send_after(expire() * 1000, self(), clean),
{ok, ok}.
-handle_call(_Request, _From, State) ->
- {reply, bad_request, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
handle_info(clean, State) ->
{MegaSecs, Secs, MiniSecs} = os:timestamp(),
@@ -167,7 +170,9 @@ handle_info(clean, State) ->
erlang:send_after(trunc(expire() * 1000 * (1 + MiniSecs / 1000000)),
self(), clean),
{noreply, State};
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
terminate(_Reason, _State) -> ok.
diff --git a/src/ejabberd_riak.erl b/src/ejabberd_riak.erl
index 5bf783612..05015a204 100644
--- a/src/ejabberd_riak.erl
+++ b/src/ejabberd_riak.erl
@@ -447,19 +447,20 @@ init([Server, Port, Options]) ->
%% @private
handle_call(get_pid, _From, #state{pid = Pid} = State) ->
{reply, {ok, Pid}, State};
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
%% @private
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
%% @private
handle_info({'DOWN', _MonitorRef, _Type, _Object, _Info}, State) ->
{stop, normal, State};
-handle_info(_Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [_Info]),
+handle_info(Info, State) ->
+ ?ERROR_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
%% @private
diff --git a/src/ejabberd_router_mnesia.erl b/src/ejabberd_router_mnesia.erl
index cfca2f980..98d03cdd9 100644
--- a/src/ejabberd_router_mnesia.erl
+++ b/src/ejabberd_router_mnesia.erl
@@ -161,11 +161,12 @@ init([]) ->
fun(#route{pid = Pid}) -> Pid end))),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({mnesia_table_event,
diff --git a/src/ejabberd_router_multicast.erl b/src/ejabberd_router_multicast.erl
index 463444add..59df9ec9d 100644
--- a/src/ejabberd_router_multicast.erl
+++ b/src/ejabberd_router_multicast.erl
@@ -136,9 +136,9 @@ init([]) ->
%% {stop, Reason, State}
%% Description: Handling call messages
%%--------------------------------------------------------------------
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
%%--------------------------------------------------------------------
%% Function: handle_cast(Msg, State) -> {noreply, State} |
@@ -146,7 +146,8 @@ handle_call(_Request, _From, State) ->
%% {stop, Reason, State}
%% Description: Handling cast messages
%%--------------------------------------------------------------------
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
%%--------------------------------------------------------------------
@@ -182,7 +183,8 @@ handle_info({'DOWN', _Ref, _Type, Pid, _Info}, State) ->
end,
mnesia:transaction(F),
{noreply, State};
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
%%--------------------------------------------------------------------
diff --git a/src/ejabberd_router_redis.erl b/src/ejabberd_router_redis.erl
index 3213901a6..b0f79d2a3 100644
--- a/src/ejabberd_router_redis.erl
+++ b/src/ejabberd_router_redis.erl
@@ -131,11 +131,12 @@ init([]) ->
clean_table(),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info(Info, State) ->
diff --git a/src/ejabberd_sm.erl b/src/ejabberd_sm.erl
index 13ffa1af0..7d34e66bb 100644
--- a/src/ejabberd_sm.erl
+++ b/src/ejabberd_sm.erl
@@ -491,10 +491,13 @@ init([]) ->
{stop, Why}
end.
-handle_call(_Request, _From, State) ->
- Reply = ok, {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
handle_info({route, Packet}, State) ->
try route(Packet)
diff --git a/src/ejabberd_sm_mnesia.erl b/src/ejabberd_sm_mnesia.erl
index 5e36a3d8a..9626ba3d6 100644
--- a/src/ejabberd_sm_mnesia.erl
+++ b/src/ejabberd_sm_mnesia.erl
@@ -41,6 +41,7 @@
terminate/2, code_change/3, start_link/0]).
-include("ejabberd_sm.hrl").
+-include("logger.hrl").
-include_lib("stdlib/include/ms_transform.hrl").
-record(state, {}).
@@ -102,11 +103,12 @@ init([]) ->
mnesia:subscribe(system),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
@@ -123,7 +125,8 @@ handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
mnesia:dirty_delete_object(S)
end, Sessions),
{noreply, State};
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/ejabberd_sm_redis.erl b/src/ejabberd_sm_redis.erl
index 67e7701c6..c552f7285 100644
--- a/src/ejabberd_sm_redis.erl
+++ b/src/ejabberd_sm_redis.erl
@@ -148,11 +148,12 @@ init([]) ->
{error, Why} -> {stop, Why}
end.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({redis_message, ?SM_KEY, Data}, State) ->
@@ -220,7 +221,7 @@ clean_table(Node) ->
end.
clean_node_sessions(Node, Host) ->
- case load_script() of
+ case load_script() of
{ok, SHA} ->
clean_node_sessions(Node, Host, SHA);
Err ->
diff --git a/src/ext_mod.erl b/src/ext_mod.erl
index 607f7b080..75338b991 100644
--- a/src/ext_mod.erl
+++ b/src/ext_mod.erl
@@ -63,14 +63,16 @@ add_paths() ->
[code:add_patha(module_ebin_dir(Module))
|| {Module, _} <- installed()].
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_announce.erl b/src/mod_announce.erl
index bdd2751b7..dab1eb6f6 100644
--- a/src/mod_announce.erl
+++ b/src/mod_announce.erl
@@ -117,7 +117,8 @@ init([Host, Opts]) ->
?MODULE, send_motd, 50),
{ok, #state{host = Host}}.
-handle_call(_Call, _From, State) ->
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}.
handle_cast({F, #message{from = From, to = To} = Pkt}, State) when is_atom(F) ->
diff --git a/src/mod_bosh_mnesia.erl b/src/mod_bosh_mnesia.erl
index 824e06b55..fd3135c31 100644
--- a/src/mod_bosh_mnesia.erl
+++ b/src/mod_bosh_mnesia.erl
@@ -102,11 +102,12 @@ handle_call({write, Session}, _From, State) ->
handle_call({delete, Session}, _From, State) ->
Res = delete_session(Session),
{reply, Res, State};
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({write, Session}, State) ->
@@ -115,8 +116,8 @@ handle_info({write, Session}, State) ->
handle_info({delete, Session}, State) ->
delete_session(Session),
{noreply, State};
-handle_info(_Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [_Info]),
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_bosh_redis.erl b/src/mod_bosh_redis.erl
index c1840604e..a55fbdf09 100644
--- a/src/mod_bosh_redis.erl
+++ b/src/mod_bosh_redis.erl
@@ -1,7 +1,7 @@
%%%----------------------------------------------------------------------
%%% File : mod_bosh_redis.erl
%%% Author : Evgeny Khramtsov <ekhramtsov@process-one.net>
-%%% Purpose :
+%%% Purpose :
%%% Created : 28 Mar 2017 by Evgeny Khramtsov <ekhramtsov@process-one.net>
%%%
%%%
@@ -107,18 +107,19 @@ init([]) ->
clean_table(),
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({redis_message, ?BOSH_KEY, SID}, State) ->
ets_cache:delete(?BOSH_CACHE, SID),
{noreply, State};
handle_info(Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [Info]),
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_caps.erl b/src/mod_caps.erl
index ca1269194..05f28a5a2 100644
--- a/src/mod_caps.erl
+++ b/src/mod_caps.erl
@@ -288,10 +288,13 @@ init([Host, Opts]) ->
handle_call(stop, _From, State) ->
{stop, normal, ok, State};
-handle_call(_Req, _From, State) ->
- {reply, {error, badarg}, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
handle_info({iq_reply, IQReply, {Host, From, To, Caps, SubNodes}}, State) ->
feature_response(IQReply, Host, From, To, Caps, SubNodes),
diff --git a/src/mod_fail2ban.erl b/src/mod_fail2ban.erl
index 770393914..1647f69bb 100644
--- a/src/mod_fail2ban.erl
+++ b/src/mod_fail2ban.erl
@@ -135,12 +135,12 @@ init([Host, _Opts]) ->
erlang:send_after(?CLEAN_INTERVAL, self(), clean),
{ok, #state{host = Host}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast(_Msg, State) ->
- ?ERROR_MSG("Unexpected cast = ~p", [_Msg]),
+ ?WARNING_MSG("Unexpected cast = ~p", [_Msg]),
{noreply, State}.
handle_info(clean, State) ->
@@ -152,7 +152,7 @@ handle_info(clean, State) ->
erlang:send_after(?CLEAN_INTERVAL, self(), clean),
{noreply, State};
handle_info(_Info, State) ->
- ?ERROR_MSG("Unexpected info = ~p", [_Info]),
+ ?WARNING_MSG("Unexpected info = ~p", [_Info]),
{noreply, State}.
terminate(_Reason, #state{host = Host}) ->
diff --git a/src/mod_http_fileserver.erl b/src/mod_http_fileserver.erl
index 71cc6b178..ea52eda6b 100644
--- a/src/mod_http_fileserver.erl
+++ b/src/mod_http_fileserver.erl
@@ -198,8 +198,9 @@ handle_call({serve, LocalPath, Auth, RHeaders}, _From, State) ->
State#state.default_content_type, State#state.content_types,
State#state.user_access, IfModifiedSince),
{reply, Reply, State};
-handle_call(_Request, _From, State) ->
- {reply, ok, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
%%--------------------------------------------------------------------
%% Function: handle_cast(Msg, State) -> {noreply, State} |
@@ -231,7 +232,8 @@ handle_cast(Msg, State) ->
%% {stop, Reason, State}
%% Description: Handling all non call/cast messages
%%--------------------------------------------------------------------
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
%%--------------------------------------------------------------------
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl
index 9cd828ebf..a3414b3b1 100644
--- a/src/mod_http_upload.erl
+++ b/src/mod_http_upload.erl
@@ -301,12 +301,12 @@ handle_call(get_conf, _From,
custom_headers = CustomHeaders} = State) ->
{reply, {ok, DocRoot, CustomHeaders}, State};
handle_call(Request, From, State) ->
- ?ERROR_MSG("Unexpected request from ~p: ~p", [From, Request]),
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}.
-spec handle_cast(_, state()) -> {noreply, state()}.
handle_cast(Request, State) ->
- ?ERROR_MSG("Unexpected request: ~p", [Request]),
+ ?WARNING_MSG("Unexpected cast: ~p", [Request]),
{noreply, State}.
-spec handle_info(timeout | _, state()) -> {noreply, state()}.
@@ -337,7 +337,7 @@ handle_info({timeout, _TRef, Slot}, State) ->
NewState = del_slot(Slot, State),
{noreply, NewState};
handle_info(Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [Info]),
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
-spec terminate(normal | shutdown | {shutdown, _} | _, state()) -> ok.
diff --git a/src/mod_mix.erl b/src/mod_mix.erl
index 6b768b702..a3f80d5ad 100644
--- a/src/mod_mix.erl
+++ b/src/mod_mix.erl
@@ -268,8 +268,8 @@ init([Host, Opts]) ->
{stop, db_failure}
end.
-handle_call(Request, _From, State) ->
- ?WARNING_MSG("Unexpected call: ~p", [Request]),
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
{noreply, State}.
handle_cast(Request, State) ->
diff --git a/src/mod_mqtt.erl b/src/mod_mqtt.erl
index 1649ef50d..c76d910a4 100644
--- a/src/mod_mqtt.erl
+++ b/src/mod_mqtt.erl
@@ -176,14 +176,16 @@ init([Host, Opts]) ->
{stop, Why}
end.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_muc_mnesia.erl b/src/mod_muc_mnesia.erl
index 0b1321f62..e5b98fb78 100644
--- a/src/mod_muc_mnesia.erl
+++ b/src/mod_muc_mnesia.erl
@@ -329,11 +329,12 @@ init([_Host, Opts]) ->
end,
{ok, #state{}}.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
@@ -342,7 +343,7 @@ handle_info({mnesia_system_event, {mnesia_down, Node}}, State) ->
handle_info({mnesia_system_event, {mnesia_up, _Node}}, State) ->
{noreply, State};
handle_info(Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [Info]),
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_ping.erl b/src/mod_ping.erl
index e0e2aec6d..1d926708b 100644
--- a/src/mod_ping.erl
+++ b/src/mod_ping.erl
@@ -107,8 +107,9 @@ terminate(_Reason, #state{host = Host}) ->
handle_call(stop, _From, State) ->
{stop, normal, ok, State};
-handle_call(_Req, _From, State) ->
- {reply, {error, badarg}, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast({reload, Host, NewOpts, _OldOpts},
#state{timers = Timers} = OldState) ->
@@ -162,7 +163,9 @@ handle_info({timeout, _TRef, {ping, JID}}, State) ->
Timers = add_timer(JID, State#state.ping_interval,
State#state.timers),
{noreply, State#state{timers = Timers}};
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
code_change(_OldVsn, State, _Extra) -> {ok, State}.
diff --git a/src/mod_proxy65_mnesia.erl b/src/mod_proxy65_mnesia.erl
index 89dd24800..3f8c934ab 100644
--- a/src/mod_proxy65_mnesia.erl
+++ b/src/mod_proxy65_mnesia.erl
@@ -136,14 +136,16 @@ handle_call({activate_stream, SHA1, Initiator, MaxConnections}, _From, State) ->
end,
Reply = mnesia:transaction(F),
{reply, Reply, State};
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_proxy65_service.erl b/src/mod_proxy65_service.erl
index 468c2e8c7..bac3911fe 100644
--- a/src/mod_proxy65_service.erl
+++ b/src/mod_proxy65_service.erl
@@ -93,10 +93,13 @@ handle_info({route, Packet}, State) ->
misc:format_exception(2, Class, Reason, StackTrace)])
end,
{noreply, State};
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
-handle_call(_Request, _From, State) ->
- {reply, ok, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast({reload, ServerHost, NewOpts, OldOpts}, State) ->
NewHosts = gen_mod:get_opt_hosts(NewOpts),
diff --git a/src/mod_shared_roster_ldap.erl b/src/mod_shared_roster_ldap.erl
index c48715718..4790b4cd3 100644
--- a/src/mod_shared_roster_ldap.erl
+++ b/src/mod_shared_roster_ldap.erl
@@ -232,14 +232,19 @@ init([Host, Opts]) ->
handle_call(get_state, _From, State) ->
{reply, {ok, State}, State};
-handle_call(_Request, _From, State) ->
- {reply, {error, badarg}, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
handle_cast({set_state, NewState}, _State) ->
{noreply, NewState};
-handle_cast(_Msg, State) -> {noreply, State}.
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
+ {noreply, State}.
-handle_info(_Info, State) -> {noreply, State}.
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
+ {noreply, State}.
terminate(_Reason, State) ->
Host = State#state.host,
diff --git a/src/mod_sip_registrar.erl b/src/mod_sip_registrar.erl
index 26a4398ea..0ff2623f0 100644
--- a/src/mod_sip_registrar.erl
+++ b/src/mod_sip_registrar.erl
@@ -198,11 +198,12 @@ handle_call({delete, US, CallID, CSeq}, _From, State) ->
handle_call({ping, SIPSocket}, _From, State) ->
Res = process_ping(SIPSocket),
{reply, Res, State};
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
handle_info({write, Sessions, Supported}, State) ->
@@ -222,8 +223,8 @@ handle_info({'DOWN', MRef, process, _Pid, _Reason}, State) ->
ok
end,
{noreply, State};
-handle_info(_Info, State) ->
- ?ERROR_MSG("Unexpected info: ~p", [_Info]),
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl
index cd2d9a1cf..c5a9fc617 100644
--- a/src/mod_vcard_ldap.erl
+++ b/src/mod_vcard_ldap.erl
@@ -194,14 +194,16 @@ init([Host, Opts]) ->
handle_call(get_state, _From, State) ->
{reply, {ok, State}, State};
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->
diff --git a/src/translate.erl b/src/translate.erl
index 2c277c5da..72028e60a 100644
--- a/src/translate.erl
+++ b/src/translate.erl
@@ -58,14 +58,16 @@ init([]) ->
{stop, Reason}
end.
-handle_call(_Request, _From, State) ->
- Reply = ok,
- {reply, Reply, State}.
+handle_call(Request, From, State) ->
+ ?WARNING_MSG("Unexpected call from ~p: ~p", [From, Request]),
+ {noreply, State}.
-handle_cast(_Msg, State) ->
+handle_cast(Msg, State) ->
+ ?WARNING_MSG("Unexpected cast: ~p", [Msg]),
{noreply, State}.
-handle_info(_Info, State) ->
+handle_info(Info, State) ->
+ ?WARNING_MSG("Unexpected info: ~p", [Info]),
{noreply, State}.
terminate(_Reason, _State) ->