]> source.dussan.org Git - rspamd.git/commitdiff
Fix misprint in multimap module.
authorVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 18 Mar 2011 13:07:23 +0000 (16:07 +0300)
committerVsevolod Stakhov <vsevolod@rambler-co.ru>
Fri, 18 Mar 2011 13:07:23 +0000 (16:07 +0300)
Fix how we detect weight of symbol in a cache.

src/plugins/lua/multimap.lua
src/symbols_cache.c

index 699d2cc7595869e568fbbf68650eb35e4111f49e..023801e459592c267d1ea87abb813902b59c8412 100644 (file)
@@ -103,11 +103,11 @@ function check_multimap(task)
                                                        local _,_,ext = string.find(r['addr'], rule['pattern'])
                                                        if ext then
                                                                if rule['cdb'] then
-                                                                       if rule['hash']:lookup(hv) then
+                                                                       if rule['hash']:lookup(ext) then
                                                                                task:insert_result(rule['symbol'], 1)
                                                                        end
                                                                else
-                                                                       if rule['hash']:get_key(hv) then
+                                                                       if rule['hash']:get_key(ext) then
                                                                                task:insert_result(rule['symbol'], 1)
                                                                        end
                                                                end
index 492387bac5fbb910261e8b98acd69b2ec0780fec..ca76ffe86085e439b95eda3a342b9d0277daf3a1 100644 (file)
@@ -263,14 +263,6 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double
                *cache = pcache;
                pcache->static_pool = memory_pool_new (memory_pool_get_size ());
        }
-
-       
-       if (weight > 0) {
-               target = &(*cache)->static_items;
-       }
-       else {
-               target = &(*cache)->negative_items;
-       }
        
        item = memory_pool_alloc0 (pcache->static_pool, sizeof (struct cache_item));
        item->s = memory_pool_alloc0 (pcache->static_pool, sizeof (struct saved_cache_item));
@@ -296,6 +288,14 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double
        else {
                item->s->weight = weight;
        }
+
+       if (item->s->weight > 0) {
+               target = &(*cache)->static_items;
+       }
+       else {
+               target = &(*cache)->negative_items;
+       }
+
        pcache->used_items++;
        msg_debug ("used items: %d, added symbol: %s", (*cache)->used_items, name);
        set_counter (item->s->symbol, 0);