]> source.dussan.org Git - rspamd.git/commitdiff
Fix work with lua 5.2 eventually.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Nov 2013 22:38:03 +0000 (22:38 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 5 Nov 2013 22:38:03 +0000 (22:38 +0000)
CMakeLists.txt
src/lua/lua_common.h
src/plugins/lua/multimap.lua
src/plugins/lua/phishing.lua

index 7bac51678ec199ee5afade472e4e94e7e973b07f..e558c93e5063873c1f24e51eea2cb5545b3003ca 100644 (file)
@@ -453,9 +453,9 @@ ENDIF(NOT LOCALSTATES_PREFIX)
 # Now find libraries and headers
 
 # Find lua libraries
-FindLua(5 1)
+FindLua(5 2)
 IF(NOT LUA_FOUND)
-       FindLua(5 2)
+       FindLua(5 1)
 ENDIF(NOT LUA_FOUND)
 
 IF(NOT LUA_FOUND)
index e2e2f032ab1533249876a03afca2b81318cb6873..fd4058c11ce0d97537abff7acf12038ce758d54d 100644 (file)
@@ -23,7 +23,9 @@
 static inline void
 luaL_register (lua_State *L, const gchar *name, const struct luaL_reg *methods)
 {
-    lua_newtable (L);
+       if (name != NULL) {
+               lua_newtable (L);
+       }
     luaL_setfuncs (L, methods, 0);
     if (name != NULL) {
        lua_pushvalue (L, -1);
index 0366d4843741326bc205981f11eff0e42adbecfb..078c00bc07ee23f8152439ebf718b4aca44e6581 100644 (file)
@@ -14,7 +14,7 @@ function split(str, delim, maxNb)
        local pat = "(.-)" .. delim .. "()"
        local nb = 0
        local lastPos
-       for part, pos in string.gfind(str, pat) do
+       for part, pos in string.gmatch(str, pat) do
                nb = nb + 1
                result[nb] = part
                lastPos = pos
index 4d72ff806a34097eef624d6552539c8cf1c539fb..ee66b9d91a342cb19fedd1689a5dfd016a2ba712 100644 (file)
@@ -14,7 +14,7 @@ function phishing_cb (task)
                                local found = false
                                local purl = url:get_phished()
                                if table.maxn(strict_domains) > 0 then
-                                       local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$')
+                                       local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+%.[a-zA-Z0-9%-]+)$')
                                        if tld then
                                                for _,rule in ipairs(strict_domains) do
                                                        if rule['map']:get_key(tld) then
@@ -26,7 +26,7 @@ function phishing_cb (task)
                                end
                                if not found then
                                        if domains then
-                                               local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+\.[a-zA-Z0-9%-]+)$')
+                                               local _,_,tld = string.find(purl:get_host(), '([a-zA-Z0-9%-]+%.[a-zA-Z0-9%-]+)$')
                                                if tld then
                                                        if domains:get_key(tld) then
                                                                task:insert_result(symbol, 1, purl:get_host())