From: Vsevolod Stakhov Date: Thu, 8 Apr 2010 15:42:56 +0000 (+0400) Subject: * Insert fuzzy check symbol correctly as it depends not only on factor but also to... X-Git-Tag: 0.3.0~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=613b5f34598f60ff964c9f8962b296f3f7b9f984;p=thirdparty%2Frspamd.git * Insert fuzzy check symbol correctly as it depends not only on factor but also to normalizer --- diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 0a58464d69..bb66d10372 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 bb51af872d..d129664fd0 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) {