aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/regexp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-20 16:52:31 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-03-20 16:52:31 +0000
commitc11152d9ec349554710f8104ef3b2321cfe8a068 (patch)
tree2e5dafc63b4ec3c3790c51667e4e82c6894b2c66 /src/plugins/regexp.c
parent3f72bccd49234103b6ed4adee6f26f9c1d12d8d0 (diff)
downloadrspamd-c11152d9ec349554710f8104ef3b2321cfe8a068.tar.gz
rspamd-c11152d9ec349554710f8104ef3b2321cfe8a068.zip
[Feature] Allow to specify maximum number of shots for symbols
Diffstat (limited to 'src/plugins/regexp.c')
-rw-r--r--src/plugins/regexp.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index f2d3ab2c3..f73a31bd4 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -127,7 +127,7 @@ regexp_module_config (struct rspamd_config *cfg)
struct regexp_module_item *cur_item = NULL;
const ucl_object_t *sec, *value, *elt;
ucl_object_iter_t it = NULL;
- gint res = TRUE, id, nre = 0, nlua = 0;
+ gint res = TRUE, id, nre = 0, nlua = 0, nshots = cfg->default_max_shots;
if (!rspamd_config_is_module_enabled (cfg, "regexp")) {
return TRUE;
@@ -282,10 +282,20 @@ regexp_module_config (struct rspamd_config *cfg)
if (elt) {
if (ucl_object_toboolean (elt)) {
- flags |= RSPAMD_SYMBOL_FLAG_ONESHOT;
+ nshots = 1;
}
}
+ if ((elt = ucl_object_lookup (value, "any_shot")) != NULL) {
+ if (ucl_object_toboolean (elt)) {
+ nshots = -1;
+ }
+ }
+
+ if ((elt = ucl_object_lookup (value, "nshots")) != NULL) {
+ nshots = ucl_object_toint (elt);
+ }
+
elt = ucl_object_lookup (value, "one_param");
if (elt) {
@@ -301,7 +311,7 @@ regexp_module_config (struct rspamd_config *cfg)
}
rspamd_config_add_metric_symbol (cfg, metric, cur_item->symbol,
- score, description, group, flags, priority);
+ score, description, group, flags, priority, nshots);
}
}
else {