aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-24 11:58:32 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-11-24 11:58:32 +0000
commite6b6f6bb9c0d29c261e2c4c9457b552b82317136 (patch)
tree9f5acd9d46e30753fd844bda793284310b89b768 /src/plugins
parente8736ad3af56d9e8087e768d49b960c351732b9e (diff)
downloadrspamd-e6b6f6bb9c0d29c261e2c4c9457b552b82317136.tar.gz
rspamd-e6b6f6bb9c0d29c261e2c4c9457b552b82317136.zip
[Rework] Use new maps add function
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/clickhouse.lua9
-rw-r--r--src/plugins/lua/greylist.lua15
-rw-r--r--src/plugins/lua/ip_score.lua10
-rw-r--r--src/plugins/lua/mid.lua9
-rw-r--r--src/plugins/lua/mime_types.lua20
-rw-r--r--src/plugins/lua/once_received.lua3
-rw-r--r--src/plugins/lua/ratelimit.lua10
-rw-r--r--src/plugins/lua/rbl.lua3
8 files changed, 25 insertions, 54 deletions
diff --git a/src/plugins/lua/clickhouse.lua b/src/plugins/lua/clickhouse.lua
index 045e4a175..09e634b27 100644
--- a/src/plugins/lua/clickhouse.lua
+++ b/src/plugins/lua/clickhouse.lua
@@ -493,13 +493,8 @@ if opts then
if not settings['server'] then
rspamd_logger.infox(rspamd_config, 'no servers are specified, disabling module')
else
- if settings['from_tables'] then
- settings['from_map'] = rspamd_config:add_map({
- url = settings['from_tables'],
- description = 'clickhouse specific domains',
- type = 'regexp'
- })
- end
+ settings['from_map'] = rspamd_map_add('clickhouse', 'from_tables',
+ 'regexp', 'clickhouse specific domains')
clickhouse_first_row()
rspamd_config:register_symbol({
name = 'CLICKHOUSE_COLLECT',
diff --git a/src/plugins/lua/greylist.lua b/src/plugins/lua/greylist.lua
index 3d946fcf5..c3e0e8869 100644
--- a/src/plugins/lua/greylist.lua
+++ b/src/plugins/lua/greylist.lua
@@ -359,17 +359,10 @@ if opts then
settings[k] = v
end
end
- if settings['whitelisted_ip'] then
- whitelisted_ip = rspamd_config:add_radix_map(settings['whitelisted_ip'],
- 'Greylist whitelist ip map')
- end
- if settings['whitelist_domains_url'] and #settings['whitelist_domains_url'] > 0 then
- whitelist_domains_map = rspamd_config:add_map ({
- url = settings['whitelist_domains_url'],
- type = 'map',
- description = 'Greylist whitelist domains map'
- })
- end
+ whitelisted_ip = rspamd_map_add('greylist', 'whitelisted_ip', 'radix',
+ 'Greylist whitelist ip map')
+ whitelist_domains_map = rspamd_map_add('greylist', 'whitelist_domains_url',
+ 'map', 'Greylist whitelist domains map')
redis_params = rspamd_parse_redis_server('greylist')
if not redis_params then
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua
index e352bdaff..50775a37d 100644
--- a/src/plugins/lua/ip_score.lua
+++ b/src/plugins/lua/ip_score.lua
@@ -346,12 +346,10 @@ local configure_ip_score_module = function()
rspamd_logger.infox(rspamd_config, 'no servers are specified')
return
end
- if options['whitelist'] then
- whitelist = rspamd_config:add_radix_map(opts['whitelist'])
- end
- if options['asn_cc_whitelist'] then
- asn_cc_whitelist = rspamd_config:add_hash_map(opts['asn_cc_whitelist'])
- end
+ whitelist = rspamd_map_add('ip_score', 'asn_cc_whitelist', 'map',
+ 'IP score whitelisted ips')
+ asn_cc_whitelist = rspamd_map_add('ip_score', 'whitelist', 'radix',
+ 'IP score whitelisted ASNs/countries')
return true
end
diff --git a/src/plugins/lua/mid.lua b/src/plugins/lua/mid.lua
index 5c29f5ab4..aad626fe6 100644
--- a/src/plugins/lua/mid.lua
+++ b/src/plugins/lua/mid.lua
@@ -66,13 +66,8 @@ if opts then
settings[k] = v
end
- if settings['url'] and #settings['url'] > 0 then
- map = rspamd_config:add_map ({
- url = settings['url'],
- type = 'map',
- description = 'Message-IDs map'
- })
-
+ map = rspamd_map_add('mid', 'url', 'map', 'Message-IDs map')
+ if map then
local id = rspamd_config:register_symbol({
name = 'KNOWN_MID_CALLBACK',
type = 'callback',
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index a33bd28b9..5415674b1 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -202,21 +202,11 @@ if opts then
settings[k] = v
end
- if settings['file'] and #settings['file'] > 0 then
-
- if settings['regexp'] then
- map = rspamd_config:add_map ({
- url = settings['file'],
- type = 'regexp',
- description = 'mime types map (regexps)'
- })
- else
- map = rspamd_config:add_map ({
- url = settings['file'],
- type = 'map',
- description = 'mime types map (plain)'
- })
- end
+ local type = 'map'
+ if settings['regexp'] then type = 'regexp' end
+ map = rspamd_map_add('mime_types', 'file', type,
+ 'mime types map')
+ if map then
local id = rspamd_config:register_symbol({
callback = check_mime_type,
type = 'callback'
diff --git a/src/plugins/lua/once_received.lua b/src/plugins/lua/once_received.lua
index 8c7ed0777..65e6127c9 100644
--- a/src/plugins/lua/once_received.lua
+++ b/src/plugins/lua/once_received.lua
@@ -177,7 +177,8 @@ if opts then
good_hosts = v
end
elseif n == 'whitelist' then
- whitelist = rspamd_config:add_radix_map (v, 'once received whitelist')
+ whitelist = rspamd_map_add('once_received', 'whitelist', 'radix',
+ 'once received whitelist')
end
end
diff --git a/src/plugins/lua/ratelimit.lua b/src/plugins/lua/ratelimit.lua
index a05ebc2e9..32b2ba2d4 100644
--- a/src/plugins/lua/ratelimit.lua
+++ b/src/plugins/lua/ratelimit.lua
@@ -528,15 +528,13 @@ if opts then
end
if opts['whitelisted_ip'] then
- whitelisted_ip = rspamd_config:add_radix_map(opts['whitelisted_ip'], 'Ratelimit whitelist ip map')
+ whitelisted_ip = rspamd_map_add('ratelimit', 'whitelisted_ip', 'radix',
+ 'Ratelimit whitelist ip map')
end
if opts['whitelisted_user'] then
- whitelisted_user = rspamd_config:add_map({
- ['url'] = opts['whitelisted_user'],
- ['description'] = 'Ratelimit whitelist user map',
- ['type'] = 'set'
- })
+ whitelisted_ip = rspamd_map_add('ratelimit', 'whitelisted_user', 'set',
+ 'Ratelimit whitelist user map')
end
if opts['symbol'] then
diff --git a/src/plugins/lua/rbl.lua b/src/plugins/lua/rbl.lua
index b1d35afc4..74eb5e64b 100644
--- a/src/plugins/lua/rbl.lua
+++ b/src/plugins/lua/rbl.lua
@@ -418,7 +418,8 @@ for default, default_v in pairs(default_defaults) do
end
if(opts['local_exclude_ip_map'] ~= nil) then
- local_exclusions = rspamd_config:add_radix_map(opts['local_exclude_ip_map'])
+ local_exclusions = rspamd_map_add('rbl', 'local_exclude_ip_map', 'radix',
+ 'RBL exclusions map')
end
local white_symbols = {}