summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-23 15:47:47 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-23 15:47:47 +0000
commit650526ef75b6ab1c4de8b6c7eedf0a9af3641192 (patch)
tree00ddcaf356fcba50bda7100a8d4bc904ca3d122c /src/plugins
parentf07041e17635e7ba0bcbb0adddc61059b5f510eb (diff)
downloadrspamd-650526ef75b6ab1c4de8b6c7eedf0a9af3641192.tar.gz
rspamd-650526ef75b6ab1c4de8b6c7eedf0a9af3641192.zip
Integrate mime_expressions to the regexp module.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/regexp.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c
index a140d616c..53049656a 100644
--- a/src/plugins/regexp.c
+++ b/src/plugins/regexp.c
@@ -73,12 +73,17 @@ read_regexp_expression (rspamd_mempool_t * pool,
gboolean raw_mode)
{
struct rspamd_expression *e = NULL;
+ GError *err = NULL;
+
+ if (!rspamd_parse_expression (line, 0, &mime_expr_subr, NULL, pool, &err,
+ &e)) {
+ msg_warn ("%s = \"%s\" is invalid regexp expression: %e", symbol, line,
+ err);
+ g_error_free (err);
- /* XXX: Implement atoms parsing */
- if (e == NULL) {
- msg_warn ("%s = \"%s\" is invalid regexp expression", symbol, line);
return FALSE;
}
+
chain->expr = e;
return TRUE;
@@ -185,7 +190,7 @@ static gboolean rspamd_lua_call_expression_func(
*ptask = task;
/* Now push all arguments */
- for (i = 0; i < args->len; i ++) {
+ for (i = 0; i < (gint)args->len; i ++) {
arg = &g_array_index (args, struct expression_argument, i);
if (arg) {
switch (arg->type) {
@@ -234,12 +239,13 @@ process_regexp_item (struct rspamd_task *task, void *user_data)
&res)) {
msg_err ("error occurred when checking symbol %s", item->symbol);
}
- if (res) {
- rspamd_task_insert_result (task, item->symbol, 1, NULL);
- }
}
else {
/* Process expression */
- /* XXX: add this function */
+ res = rspamd_process_expression (item->expr, task);
+ }
+
+ if (res) {
+ rspamd_task_insert_result (task, item->symbol, res, NULL);
}
}