]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Use weight from map for fuzzy scoring 1798/head
authorJean-Louis Dupond <jean-louis@dupond.be>
Fri, 11 Aug 2017 12:32:58 +0000 (14:32 +0200)
committerJean-Louis Dupond <jean-louis@dupond.be>
Fri, 11 Aug 2017 12:32:58 +0000 (14:32 +0200)
src/plugins/fuzzy_check.c

index b270191e6c54a57eff904b7238e2b5391692d673..980374c59f18c26b85d07424e8af099e64786550 100644 (file)
@@ -1775,6 +1775,7 @@ fuzzy_insert_result (struct fuzzy_client_session *session,
        const gchar *symbol;
        struct fuzzy_mapping *map;
        struct rspamd_task *task = session->task;
+       double weight;
        double nval;
        guchar buf[2048];
        const gchar *type = "bin";
@@ -1785,11 +1786,12 @@ fuzzy_insert_result (struct fuzzy_client_session *session,
                                        GINT_TO_POINTER (rep->flag))) == NULL) {
                /* Default symbol and default weight */
                symbol = session->rule->symbol;
-
+               weight = session->rule->max_score;
        }
        else {
                /* Get symbol and weight from map */
                symbol = map->symbol;
+               weight = map->weight;
        }
 
 
@@ -1799,8 +1801,7 @@ fuzzy_insert_result (struct fuzzy_client_session *session,
         * Otherwise `value` means error code
         */
 
-       nval = fuzzy_normalize (rep->value,
-                       session->rule->max_score);
+       nval = fuzzy_normalize (rep->value, weight);
 
        if (io && (io->flags & FUZZY_CMD_FLAG_IMAGE)) {
                nval *= rspamd_normalize_probability (rep->prob, 0.5);