summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-16 18:03:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-09-16 18:03:08 +0100
commit0c8b0859135ea7bd4f1f08a15ab9a0f5c575d51f (patch)
tree8bb944a7c6a35c66d8d484a099421ec60d422589 /src
parent21d8c9a4f21c81476970c3bef2b64fef2ba68e48 (diff)
downloadrspamd-0c8b0859135ea7bd4f1f08a15ab9a0f5c575d51f.tar.gz
rspamd-0c8b0859135ea7bd4f1f08a15ab9a0f5c575d51f.zip
Fix wrongly placed g_string_free.
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_common.c1
-rw-r--r--src/plugins/lua/whitelist.lua11
2 files changed, 11 insertions, 1 deletions
diff --git a/src/lua/lua_common.c b/src/lua/lua_common.c
index bea2f0a58..519c49ded 100644
--- a/src/lua/lua_common.c
+++ b/src/lua/lua_common.c
@@ -312,7 +312,6 @@ rspamd_init_lua_filters (struct rspamd_config *cfg)
msg_err_config ("load of %s failed: %s", module->path,
lua_tostring (L, -1));
cur = g_list_next (cur);
- g_string_free (tb, TRUE);
lua_pop (L, 1); /* Error function */
continue;
}
diff --git a/src/plugins/lua/whitelist.lua b/src/plugins/lua/whitelist.lua
index 74be5dbfe..b7718636e 100644
--- a/src/plugins/lua/whitelist.lua
+++ b/src/plugins/lua/whitelist.lua
@@ -25,6 +25,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]--
local rspamd_logger = require "rspamd_logger"
+local rspamd_url = require "rspamd_url"
local ucl = require "ucl"
require "fun" ()
@@ -40,9 +41,19 @@ local function whitelist_cb(symbol, rule, task)
local from = task:get_from(1)
if from and from[1] and from[1]['domain'] then
local domain = from[1]['domain']
+ local url_domain = rspamd_url.create('http://' .. domain)
local found = false
local mult = 1.0
+ if url_domain then
+ -- Get tld + 1 component
+ local tld = url_domain:get_tld()
+ local host = url_domain:get_host()
+
+ domain = string.match(host, string.format('[^.].%s$', tld)
+ rspamd_logger.errx(domain)
+ end
+
if rule['map'] then
local val = rule['map']:get_key(domain)
if val then