commit f4efae2: [Fix] Switch to GMT

Vsevolod Stakhov vsevolod at highsecure.ru
Wed May 1 12:49:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-05-01 13:42:33 +0100
URL: https://github.com/rspamd/rspamd/commit/f4efae27e91d2666c10097701c5d1345a4b92cf7 (HEAD -> master)

[Fix] Switch to GMT

---
 lualib/rspamadm/vault.lua      | 4 ++--
 src/plugins/lua/clickhouse.lua | 2 +-
 src/plugins/lua/dmarc.lua      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lualib/rspamadm/vault.lua b/lualib/rspamadm/vault.lua
index b11ba525e..0dadaaeb4 100644
--- a/lualib/rspamadm/vault.lua
+++ b/lualib/rspamadm/vault.lua
@@ -318,7 +318,7 @@ local function newkey_handler(opts, domain)
 
   if not opts.selector then
     opts.selector = string.format('%s-%s', opts.algorithm,
-        os.date("%Y%m%d"))
+        os.date("!%Y%m%d"))
   end
 
   local err,data = rspamd_http.request{
@@ -458,7 +458,7 @@ local function roll_handler(opts, domain)
       -- Insert keys for each algorithm in pairs <old_key(s)>, <new_key>
       local sk,pk = genkey({algorithm = alg, bits = keys[1].bits})
       local selector = string.format('%s-%s', alg,
-          os.date("%Y%m%d"))
+          os.date("!%Y%m%d"))
 
       if selector == keys[1].selector then
         selector = selector .. '-1'
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 9559ef5cb..6e427682f 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -289,7 +289,7 @@ local function clickhouse_asn_row(res)
 end
 
 local function today(ts)
-  return os.date('%Y-%m-%d', ts)
+  return os.date('!%Y-%m-%d', ts)
 end
 
 local function clickhouse_check_symbol(task, symbols, need_score)
diff --git a/src/plugins/lua/dmarc.lua b/src/plugins/lua/dmarc.lua
index 8c22f84b2..2c9bf1951 100644
--- a/src/plugins/lua/dmarc.lua
+++ b/src/plugins/lua/dmarc.lua
@@ -528,7 +528,7 @@ local function dmarc_validate_policy(task, policy, hdrfromdom, dmarc_esld)
     end
 
     -- Prepare and send redis report element
-    local period = os.date('%Y%m%d',
+    local period = os.date('!%Y%m%d',
         task:get_date({format = 'connect', gmt = true}))
     local dmarc_domain_key = table.concat(
         {redis_keys.report_prefix, hdrfromdom, period}, redis_keys.join_char)


More information about the Commits mailing list