aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_dns.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-21 14:52:18 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-21 14:52:18 +0100
commite1ff872f1a1070ec27ba9c5d011e19044941a3a8 (patch)
tree57edc4ae1c0711a1043b5f6ebfa1cccb92f3426d /src/lua/lua_dns.c
parent4eef5ea9ba8af9c57b3985b4671b2c6fa0d081dd (diff)
downloadrspamd-e1ff872f1a1070ec27ba9c5d011e19044941a3a8.tar.gz
rspamd-e1ff872f1a1070ec27ba9c5d011e19044941a3a8.zip
Fix lua API for new inet addr structure.
Diffstat (limited to 'src/lua/lua_dns.c')
-rw-r--r--src/lua/lua_dns.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lua/lua_dns.c b/src/lua/lua_dns.c
index 21599220a..5e926ca2d 100644
--- a/src/lua/lua_dns.c
+++ b/src/lua/lua_dns.c
@@ -90,6 +90,7 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
gint i = 0;
struct rspamd_dns_resolver **presolver;
struct rdns_reply_entry *elt;
+ rspamd_inet_addr_t addr;
lua_rawgeti (cd->L, LUA_REGISTRYINDEX, cd->cbref);
presolver = lua_newuserdata (cd->L, sizeof (gpointer));
@@ -106,11 +107,19 @@ lua_dns_callback (struct rdns_reply *reply, gpointer arg)
LL_FOREACH (reply->entries, elt) {
switch (elt->type) {
case RDNS_REQUEST_A:
- lua_ip_push (cd->L, AF_INET, &elt->content.a.addr);
+ addr.af = AF_INET;
+ addr.slen = sizeof (addr.addr.s4);
+ memcpy (&addr.addr.s4.sin_addr, &elt->content.a.addr,
+ sizeof (addr.addr.s4.sin_addr));
+ lua_ip_push (cd->L, &addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_AAAA:
- lua_ip_push (cd->L, AF_INET6, &elt->content.aaa.addr);
+ addr.af = AF_INET6;
+ addr.slen = sizeof (addr.addr.s6);
+ memcpy (&addr.addr.s6.sin6_addr, &elt->content.aaa.addr,
+ sizeof (addr.addr.s6.sin6_addr));
+ lua_ip_push (cd->L, &addr);
lua_rawseti (cd->L, -2, ++i);
break;
case RDNS_REQUEST_PTR: