aboutsummaryrefslogtreecommitdiff
path: root/src/mod_fail2ban.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2015-06-01 15:38:27 +0300
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2015-06-01 15:38:27 +0300
commitfb6267f38ee47f3f725f88324d132741c85dfb6a (patch)
treed63c5efd207a736f9215d645ccb881bba942ed6a /src/mod_fail2ban.erl
parentDo not try to fetch module options via eldap_utils (diff)
Add config validation at startup
Diffstat (limited to 'src/mod_fail2ban.erl')
-rw-r--r--src/mod_fail2ban.erl15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mod_fail2ban.erl b/src/mod_fail2ban.erl
index 63c09db26..67b705d9a 100644
--- a/src/mod_fail2ban.erl
+++ b/src/mod_fail2ban.erl
@@ -31,9 +31,9 @@
%% API
-export([start_link/2, start/2, stop/1, c2s_auth_result/4, check_bl_c2s/3]).
-%% gen_server callbacks
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- terminate/2, code_change/3]).
+-export([init/1, handle_call/3, handle_cast/2,
+ handle_info/2, terminate/2, code_change/3,
+ mod_opt_type/1]).
-include_lib("stdlib/include/ms_transform.hrl").
-include("ejabberd.hrl").
@@ -187,3 +187,12 @@ is_loaded_at_other_hosts(Host) ->
format_date({{Year, Month, Day}, {Hour, Minute, Second}}) ->
io_lib:format("~2..0w:~2..0w:~2..0w ~2..0w.~2..0w.~4..0w",
[Hour, Minute, Second, Day, Month, Year]).
+
+mod_opt_type(access) ->
+ fun (A) when is_atom(A) -> A end;
+mod_opt_type(c2s_auth_ban_lifetime) ->
+ fun (T) when is_integer(T), T > 0 -> T end;
+mod_opt_type(c2s_max_auth_failures) ->
+ fun (I) when is_integer(I), I > 0 -> I end;
+mod_opt_type(_) ->
+ [access, c2s_auth_ban_lifetime, c2s_max_auth_failures].