Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2016-01-05 14:29:13 +0300
committerBadlop <badlop@process-one.net>2016-01-05 14:29:21 +0300
commitc01e3f24a5e7153805524068e0365a0ee623710e (patch)
tree72222423d0ec214c8da6512b10dd88fb243e140b /src
parentda45a064a8a2e70ce35163182d9eaf8000b56f70 (diff)
Error converting times in mod_fail2ban (#889)
Diffstat (limited to 'src')
-rw-r--r--src/mod_fail2ban.erl5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mod_fail2ban.erl b/src/mod_fail2ban.erl
index 523cbb3f9..394a7186f 100644
--- a/src/mod_fail2ban.erl
+++ b/src/mod_fail2ban.erl
@@ -83,7 +83,7 @@ check_bl_c2s(_Acc, Addr, Lang) ->
true ->
IP = jlib:ip_to_list(Addr),
UnbanDate = format_date(
- calendar:now_to_universal_time(TS)),
+ calendar:now_to_universal_time(seconds_to_now(TS))),
LogReason = io_lib:fwrite(
"Too many (~p) failed authentications "
"from this IP address (~s). The address "
@@ -179,6 +179,9 @@ is_loaded_at_other_hosts(Host) ->
gen_mod:is_loaded(VHost, ?MODULE)
end, ?MYHOSTS).
+seconds_to_now(Secs) ->
+ {Secs div 1000000, Secs rem 1000000, 0}.
+
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]).