diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-09 13:18:53 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-09 13:18:53 +0100 |
commit | 2bec49d2580bcda5c7d143b609b88e5076a37a2d (patch) | |
tree | b0c613cbb57b7a7ed7f94606d80924145cca6a9a | |
parent | 197add7f46d4974a794fa3bacdd1fa6104037466 (diff) | |
download | rspamd-2bec49d2580bcda5c7d143b609b88e5076a37a2d.tar.gz rspamd-2bec49d2580bcda5c7d143b609b88e5076a37a2d.zip |
[Feature] Support mime regexps in the expressions
-rw-r--r-- | src/libmime/mime_expressions.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index f5e6d4e48..ea8af2dcd 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -282,6 +282,14 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line, result->type = RSPAMD_RE_HEADER; p++; break; + case 'R': + result->type = RSPAMD_RE_RAWHEADER; + p++; + break; + case 'B': + result->type = RSPAMD_RE_MIMEHEADER; + p++; + break; case 'M': result->type = RSPAMD_RE_BODY; p++; @@ -302,6 +310,7 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line, result->type = RSPAMD_RE_RAWHEADER; p++; break; + /* Other flags */ case 'T': result->is_test = TRUE; p++; @@ -326,6 +335,15 @@ rspamd_mime_expr_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line, return NULL; } + if ((result->type == RSPAMD_RE_HEADER || + result->type == RSPAMD_RE_RAWHEADER || + result->type == RSPAMD_RE_MIMEHEADER) && + result->header == NULL) { + msg_err_pool ("header regexp: '%s' has no header part", src); + return NULL; + } + + result->regexp_text = rspamd_mempool_strdup (pool, start); dbegin = result->regexp_text + (begin - start); dend = result->regexp_text + (end - start); |