From: Alexander Moisseev Date: Tue, 17 Feb 2026 13:13:48 +0000 (+0300) Subject: [Fix] Distinguish explicit multi-class from legacy binary configs X-Git-Tag: 4.0.0~82^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8865769b36b60f4d3e7b97034fd5c1ca86eb2f4;p=thirdparty%2Frspamd.git [Fix] Distinguish explicit multi-class from legacy binary configs Check is_spam_converted flag to differentiate between: - Explicit class declaration (new format) -> multi-class - Converted is_spam=true/false (legacy) -> binary This fixes incorrect "binary" detection for explicit multi-class configurations using class="spam" and class="ham". --- diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 379e918ac2..b16137f029 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -1766,6 +1766,7 @@ rspamd_classifier_type(const struct rspamd_classifier_config *cfg) gboolean has_spam = FALSE; gboolean has_ham = FALSE; gboolean has_other = FALSE; + gboolean has_explicit_classes = FALSE; GList *cur; if (cfg == NULL) { @@ -1780,6 +1781,10 @@ rspamd_classifier_type(const struct rspamd_classifier_config *cfg) continue; } + if (!stcf->is_spam_converted) { + has_explicit_classes = TRUE; + } + if (g_ascii_strcasecmp(stcf->class_name, "spam") == 0) { has_spam = TRUE; } @@ -1791,6 +1796,12 @@ rspamd_classifier_type(const struct rspamd_classifier_config *cfg) } } + /* If any statfile has explicit class (not converted from is_spam) */ + if (has_explicit_classes) { + return "multi-class"; + } + + /* Legacy binary: spam=true/false converted to class names */ if (has_spam && has_ham && !has_other) { return "binary"; }