diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-11 15:06:01 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-04-11 15:06:01 +0100 |
commit | 5080c1565010de3a198507bc35dadd0cc3aad210 (patch) | |
tree | 1b55b8130b782627e1a377dfe70bd5f03376a0e6 /src/lua/lua_dns_resolver.c | |
parent | 6943c3c3a4dd1334aa041fcd7df9598ecec3f152 (diff) | |
download | rspamd-5080c1565010de3a198507bc35dadd0cc3aad210.tar.gz rspamd-5080c1565010de3a198507bc35dadd0cc3aad210.zip |
[Minor] Allow to set a resolver for task
Diffstat (limited to 'src/lua/lua_dns_resolver.c')
-rw-r--r-- | src/lua/lua_dns_resolver.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/lua/lua_dns_resolver.c b/src/lua/lua_dns_resolver.c index e06db3a44..4234504ee 100644 --- a/src/lua/lua_dns_resolver.c +++ b/src/lua/lua_dns_resolver.c @@ -43,8 +43,6 @@ end static const gchar *M = "rspamd lua dns resolver"; -struct rspamd_dns_resolver * lua_check_dns_resolver (lua_State * L); - /* Lua bindings */ LUA_FUNCTION_DEF (dns_resolver, init); LUA_FUNCTION_DEF (dns_resolver, resolve_a); @@ -73,10 +71,10 @@ static const struct luaL_reg dns_resolverlib_m[] = { }; struct rspamd_dns_resolver * -lua_check_dns_resolver (lua_State * L) +lua_check_dns_resolver (lua_State * L, gint pos) { - void *ud = rspamd_lua_check_udata (L, 1, "rspamd{resolver}"); - luaL_argcheck (L, ud != NULL, 1, "'resolver' expected"); + void *ud = rspamd_lua_check_udata (L, pos, "rspamd{resolver}"); + luaL_argcheck (L, ud != NULL, pos, "'resolver' expected"); return ud ? *((struct rspamd_dns_resolver **)ud) : NULL; } @@ -532,7 +530,7 @@ err: static int lua_dns_resolver_resolve_a (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); if (dns_resolver) { return lua_dns_resolver_resolve_common (L, @@ -562,7 +560,7 @@ lua_dns_resolver_resolve_a (lua_State *L) static int lua_dns_resolver_resolve_ptr (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); if (dns_resolver) { return lua_dns_resolver_resolve_common (L, @@ -592,7 +590,7 @@ lua_dns_resolver_resolve_ptr (lua_State *L) static int lua_dns_resolver_resolve_txt (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); if (dns_resolver) { return lua_dns_resolver_resolve_common (L, @@ -622,7 +620,7 @@ lua_dns_resolver_resolve_txt (lua_State *L) static int lua_dns_resolver_resolve_mx (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); if (dns_resolver) { return lua_dns_resolver_resolve_common (L, @@ -652,7 +650,7 @@ lua_dns_resolver_resolve_mx (lua_State *L) static int lua_dns_resolver_resolve_ns (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); if (dns_resolver) { return lua_dns_resolver_resolve_common (L, @@ -671,7 +669,7 @@ lua_dns_resolver_resolve_ns (lua_State *L) static int lua_dns_resolver_resolve (lua_State *L) { - struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L); + struct rspamd_dns_resolver *dns_resolver = lua_check_dns_resolver (L, 1); int type; type = lua_dns_get_type (L, 2); |