]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Another fix after the last merge
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 10 Mar 2019 21:36:35 +0000 (21:36 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 10 Mar 2019 21:36:35 +0000 (21:36 +0000)
src/plugins/surbl.c

index 46c769a783cd24b0a97036225d3ccd4a28e55636..71f07a604bf3f4ee3d1838d3a3e06691a1786b0b 100644 (file)
@@ -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);
                }
        }