commit fddff81: [Minor] Another fix after the last merge

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Mar 10 21:42:04 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-03-10 21:36:35 +0000
URL: https://github.com/rspamd/rspamd/commit/fddff8187c824b52740f0d7791fdb4e33e560edc (HEAD -> master)

[Minor] Another fix after the last merge

---
 src/plugins/surbl.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/plugins/surbl.c b/src/plugins/surbl.c
index 46c769a78..71f07a604 100644
--- a/src/plugins/surbl.c
+++ b/src/plugins/surbl.c
@@ -620,9 +620,16 @@ register_bit_symbols (struct rspamd_config *cfg, struct suffix_item *suffix,
 
 		while (g_hash_table_iter_next (&it, &k, &v)) {
 			bit = v;
-			rspamd_symcache_add_symbol (cfg->cache, bit->symbol,
-					0, NULL, NULL,
-					SYMBOL_TYPE_VIRTUAL, parent_id);
+
+			/*
+			 * We can have multiple IPs mapped to a single symbol,
+			 * so skip symbol's registration to avoid duplicates
+			 */
+			if (rspamd_symcache_find_symbol (cfg->cache, bit->symbol) == -1) {
+				rspamd_symcache_add_symbol (cfg->cache, bit->symbol,
+						0, NULL, NULL,
+						SYMBOL_TYPE_VIRTUAL, parent_id);
+			}
 			msg_debug_config ("bit: %d", bit->bit);
 		}
 	}


More information about the Commits mailing list