]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix some issues with lua_dns.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Jul 2015 13:54:12 +0000 (14:54 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 21 Jul 2015 14:04:02 +0000 (15:04 +0100)
src/lua/lua_dns.c

index de7a0c2e898ce845f32f619fb5e9921318490d9b..a471662e28a6aee334a23efa4d04242c10b2a82f 100644 (file)
@@ -277,7 +277,7 @@ lua_dns_resolver_resolve_common (lua_State *L,
                lua_gettable (L, -2);
 
                if (to_resolve == NULL || lua_type (L, -1) != LUA_TFUNCTION) {
-                       lua_pop (L, 1);
+                       lua_pop (L, 2);
                        msg_err ("DNS request has bad params");
                        lua_pushboolean (L, FALSE);
                        return 1;
@@ -315,6 +315,13 @@ lua_dns_resolver_resolve_common (lua_State *L,
                        lua_pop (L, 1);
                }
 
+               lua_pushstring (L, "option");
+               lua_gettable (L, -2);
+               if (lua_type (L, -1) == LUA_TSTRING) {
+                       user_str = luaL_checkstring (L, -1);
+               }
+               lua_pop (L, 1);
+
                lua_pop (L, 1);
        }