]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Allow binary patterns in lua_trie
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 23 Apr 2016 13:49:59 +0000 (14:49 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 23 Apr 2016 13:49:59 +0000 (14:49 +0100)
src/lua/lua_trie.c

index 5803a1d0bd0019f18a6eb73f002159784eb4046a..befb956e4e796ee30ff77d4be185ca8bded79e6a 100644 (file)
@@ -112,8 +112,11 @@ lua_trie_create (lua_State *L)
 
                while (lua_next (L, -2) != 0) {
                        if (lua_isstring (L, -1)) {
-                               rspamd_multipattern_add_pattern (trie, lua_tostring (L, -1),
-                                               flags);
+                               const gchar *pat;
+                               gsize patlen;
+
+                               pat = lua_tolstring (L, -1, &patlen);
+                               rspamd_multipattern_add_pattern_len (trie, pat, patlen, flags);
                        }
 
                        lua_pop (L, 1);