aboutsummaryrefslogtreecommitdiffstats
path: root/src/expressions.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-04-15 17:01:01 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-04-15 17:01:01 +0400
commitd50dff03fdf56db4a24cf44e4e9eec70c69e81c3 (patch)
tree480a33e817a8bdcc66733f0712c101fd42c62947 /src/expressions.c
parent086e9da19d8ceaa605b1151c93b229a2e1040e79 (diff)
downloadrspamd-d50dff03fdf56db4a24cf44e4e9eec70c69e81c3.tar.gz
rspamd-d50dff03fdf56db4a24cf44e4e9eec70c69e81c3.zip
* For mime parts set flag 'raw' and if we cannot determine charset of part or cannot
encode it to utf8 just use for such parts raw regexps
Diffstat (limited to 'src/expressions.c')
-rw-r--r--src/expressions.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/expressions.c b/src/expressions.c
index 8dfdc17b3..085708342 100644
--- a/src/expressions.c
+++ b/src/expressions.c
@@ -632,12 +632,20 @@ parse_regexp (memory_pool_t *pool, char *line)
result->regexp = g_regex_new (begin, regexp_flags, 0, &err);
result->regexp_text = memory_pool_strdup (pool, begin);
memory_pool_add_destructor (pool, (pool_destruct_func)g_regex_unref, (void *)result->regexp);
- *end = '/';
if (result->regexp == NULL || err != NULL) {
+ *end = '/';
msg_warn ("parse_regexp: could not read regexp: %s while reading regexp %s", err->message, src);
return NULL;
}
+ result->raw_regexp = g_regex_new (begin, regexp_flags | G_REGEX_RAW, 0, &err);
+ memory_pool_add_destructor (pool, (pool_destruct_func)g_regex_unref, (void *)result->raw_regexp);
+ *end = '/';
+
+ if (result->raw_regexp == NULL || err != NULL) {
+ msg_warn ("parse_regexp: could not read raw regexp: %s while reading regexp %s", err->message, src);
+ return NULL;
+ }
/* Add to cache for further usage */
re_cache_add (result->regexp_text, result);