aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-07-28 15:47:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-07-28 15:47:51 +0100
commit0e21da4e3833d702db12e4129926d7918a1ac527 (patch)
tree70a65482b883c20bfe53655c8f83ec7f07c2cf16 /src/libmime
parenta95c5a23edaddafa96a9c62da4d541abc680b2c5 (diff)
downloadrspamd-0e21da4e3833d702db12e4129926d7918a1ac527.tar.gz
rspamd-0e21da4e3833d702db12e4129926d7918a1ac527.zip
[Project] Add `L` flag for regexps to save start of the match in Hyperscan
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/mime_expressions.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index aaefd24b3..0caa324cc 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -372,6 +372,8 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line,
case 'u':
case 'O':
case 'r':
+ case 'L':
+ /* Handled by rspamd_regexp_t */
g_string_append_c (re_flags, *p);
p++;
break;
@@ -813,6 +815,10 @@ set:
goto err;
}
else {
+ const ucl_object_t *re_conditions = ucl_object_lookup (real_ud->conf_obj,
+ "re_conditions");
+ gint lua_cbref = -1;
+
/* Check regexp condition */
if (real_ud->conf_obj == NULL) {
g_set_error (err, rspamd_mime_expr_quark(), 300,
@@ -821,10 +827,6 @@ set:
goto err;
}
- const ucl_object_t *re_conditions = ucl_object_lookup (real_ud->conf_obj,
- "re_conditions");
- gint lua_cbref = -1;
-
if (re_conditions != NULL) {
if (ucl_object_type (re_conditions) != UCL_OBJECT) {
g_set_error (err, rspamd_mime_expr_quark(), 320,
@@ -851,6 +853,10 @@ set:
}
}
+ if (lua_cbref != -1) {
+ msg_info_config ("added condition for regexp %s", mime_atom->str);
+ }
+
/* Register new item in the cache */
if (mime_atom->d.re->type == RSPAMD_RE_HEADER ||
mime_atom->d.re->type == RSPAMD_RE_RAWHEADER ||