From 8909ac45092c23bb6283ae389a5f6c94de49ad9d Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 16 Oct 2009 16:53:13 +0400 Subject: [PATCH] * Add ability to skip check in views --- src/cfg_file.l | 1 + src/cfg_file.y | 15 ++++++++++++--- src/view.c | 3 +++ src/view.h | 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/cfg_file.l b/src/cfg_file.l index 671146be1..a497aa4b6 100644 --- a/src/cfg_file.l +++ b/src/cfg_file.l @@ -44,6 +44,7 @@ view return VIEW; ip return IP; from return FROM; symbols return SYMBOLS; +skip_check return SKIP_CHECK; error_time return ERROR_TIME; dead_time return DEAD_TIME; diff --git a/src/cfg_file.y b/src/cfg_file.y index 85dcb9df5..6e0b8a20f 100644 --- a/src/cfg_file.y +++ b/src/cfg_file.y @@ -37,7 +37,7 @@ struct rspamd_view *cur_view = NULL; { char *string; size_t limit; - char flag; + gboolean flag; unsigned int seconds; unsigned int number; double fract; @@ -59,7 +59,7 @@ struct rspamd_view *cur_view = NULL; %token DELIVERY LMTP ENABLED AGENT SECTION LUACODE RAW_MODE PROFILE_FILE COUNT %token VIEW IP FROM SYMBOLS %token AUTOLEARN MIN_MARK MAX_MARK -%token SETTINGS USER_SETTINGS DOMAIN_SETTINGS SYMBOL PATH +%token SETTINGS USER_SETTINGS DOMAIN_SETTINGS SYMBOL PATH SKIP_CHECK %type STRING %type VARIABLE @@ -417,7 +417,7 @@ metricrjscore: } cur_metric->reject_score = $3; } - | REQUIRED_SCORE EQSIGN FRACT { + | REJECT_SCORE EQSIGN FRACT { if (cur_metric == NULL) { cur_metric = memory_pool_alloc0 (cfg->cfg_pool, sizeof (struct metric)); } @@ -995,6 +995,7 @@ viewcmd: | viewip | viewfrom | viewsymbols + | viewskipcheck ; viewip: @@ -1031,6 +1032,14 @@ viewsymbols: } } ; +viewskipcheck: + SKIP_CHECK EQSIGN FLAG { + if (cur_view == NULL) { + cur_view = init_view (cfg->cfg_pool); + } + cur_view->skip_check = $3; + } + ; settings: SETTINGS OBRACE settingsbody EBRACE diff --git a/src/view.c b/src/view.c index 3acd165ed..393882049 100644 --- a/src/view.c +++ b/src/view.c @@ -209,6 +209,9 @@ check_view (GList * views, const char *symbol, struct worker_task * task) check_symbol: /* selected is now not NULL */ + if (task->view->skip_check) { + return FALSE; + } if (match_view_symbol (task->view, symbol)) { return TRUE; } diff --git a/src/view.h b/src/view.h index d27336254..91a5d6277 100644 --- a/src/view.h +++ b/src/view.h @@ -13,6 +13,7 @@ struct rspamd_view { GHashTable *symbols_hash; GList *symbols_re_list; + gboolean skip_check; memory_pool_t *pool; }; -- 2.39.5