]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] Use weight from map for fuzzy scoring
authorJean-Louis Dupond <jean-louis@dupond.be>
Fri, 11 Aug 2017 12:32:58 +0000 (14:32 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 28 Aug 2017 11:20:32 +0000 (13:20 +0200)
src/plugins/fuzzy_check.c

index 85e6d2c642845f7e2b38499295056bab06a20870..5df59e1fe19a0be87fad585bd902b066590f476e 100644 (file)
@@ -1761,6 +1761,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";
@@ -1771,11 +1772,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;
        }
 
 
@@ -1785,8 +1787,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);