]> source.dussan.org Git - rspamd.git/commitdiff
* Add ability to skip check in views
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 16 Oct 2009 12:53:13 +0000 (16:53 +0400)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 16 Oct 2009 12:53:13 +0000 (16:53 +0400)
src/cfg_file.l
src/cfg_file.y
src/view.c
src/view.h

index 671146be1556358c15e144de987e63d1c6facfa4..a497aa4b6a03fccbf0b5572f859661c1f1b62ef7 100644 (file)
@@ -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;
index 85dcb9df51e4e3bd36be2360df57b55c05168f7e..6e0b8a20f2599cb1efe1d9370c4627b67837f151 100644 (file)
@@ -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>        STRING
 %type  <string>        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
index 3acd165ed71b9946fb0a23aa348f6c7ea6584eb9..393882049ad461167b7fc138a1a0ecc7721010e8 100644 (file)
@@ -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;
        }
index d27336254a20e99e0d3c2f9a794311c61eb52b1c..91a5d6277c3085a46c749b304088fee8c578b7bc 100644 (file)
@@ -13,6 +13,7 @@ struct rspamd_view {
 
        GHashTable *symbols_hash;
        GList *symbols_re_list;
+       gboolean skip_check;
 
        memory_pool_t *pool;
 };