diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-04-08 19:42:56 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-04-08 19:42:56 +0400 |
commit | 613b5f34598f60ff964c9f8962b296f3f7b9f984 (patch) | |
tree | 49c12bbfd72af35e194b4bab4c839c1d70070ec8 /src | |
parent | 4abf1404c60d6a4b530c40f4ffdf70b43f99ea1c (diff) | |
download | rspamd-613b5f34598f60ff964c9f8962b296f3f7b9f984.tar.gz rspamd-613b5f34598f60ff964c9f8962b296f3f7b9f984.zip |
* Insert fuzzy check symbol correctly as it depends not only on factor but also to normalizer
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/fuzzy_check.c | 15 | ||||
-rw-r--r-- | src/plugins/regexp.c | 11 |
2 files changed, 23 insertions, 3 deletions
diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 0a58464d6..bb66d1037 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -255,11 +255,22 @@ fuzzy_check_module_config (struct config_file *cfg) /* Search in factors hash table */ w = g_hash_table_lookup (cfg->factors, fuzzy_module_ctx->symbol); + if (w == NULL) { - register_symbol (&metric->cache, fuzzy_module_ctx->symbol, 1, fuzzy_symbol_callback, NULL); + if (fabs (fuzzy_module_ctx->max_score) < 0.001) { + register_symbol (&metric->cache, fuzzy_module_ctx->symbol, 1, fuzzy_symbol_callback, NULL); + } + else { + register_symbol (&metric->cache, fuzzy_module_ctx->symbol, fuzzy_module_ctx->max_score, fuzzy_symbol_callback, NULL); + } } else { - register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w, fuzzy_symbol_callback, NULL); + if (fabs (fuzzy_module_ctx->max_score) < 0.001) { + register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w, fuzzy_symbol_callback, NULL); + } + else { + register_symbol (&metric->cache, fuzzy_module_ctx->symbol, *w * fuzzy_module_ctx->max_score, fuzzy_symbol_callback, NULL); + } } register_custom_controller_command ("fuzzy_add", fuzzy_add_handler, TRUE, TRUE); diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index bb51af872..d129664fd 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -202,7 +202,16 @@ regexp_module_config (struct config_file *cfg) res = FALSE; } } - + else { + msg_err ("unknown variable type for %s", cur->param); + res = FALSE; + } + + if ( !res) { + /* Stop on errors */ + break; + } + /* Search in factors hash table */ w = g_hash_table_lookup (cfg->factors, cur->param); if (w == NULL) { |