]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Ratelimit: lowercase email addresses
authorAndrew Lewis <nerf@judo.za.org>
Mon, 28 Aug 2017 11:00:19 +0000 (13:00 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 28 Aug 2017 11:13:33 +0000 (13:13 +0200)
src/plugins/lua/ratelimit.lua

index 3036657f0d8be33ee67bb90d33186c27550ca841..2516d18444d206498ea6a88fd32e6db3f571a8f0 100644 (file)
@@ -287,7 +287,7 @@ local keywords = {
     ['get_value'] = function(task)
       local from = task:get_from(0)
       if ((from or E)[1] or E).addr then
-        return from[1]['addr']
+        return string.lower(from[1]['addr'])
       end
       return nil
     end,
@@ -366,7 +366,7 @@ local function dynamic_rate_key(task, rtype)
     local total_rcpt = 0
     for _, r in ipairs(rcpts) do
       if r['addr'] and total_rcpt < max_rcpt then
-        local key_f = string.format(key_s, r['addr'])
+        local key_f = string.format(key_s, string.lower(r['addr']))
         table.insert(rate_keys, key_f)
         total_rcpt = total_rcpt + 1
       end