aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2012-12-15 05:24:40 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2012-12-15 05:24:40 +0100
commit9b3419ecf4b2e149f9ef6e684dfdb15da6cddffd (patch)
tree215c279711f8c2a3898f1b81a6eaa899f8e1af91
parentTODO++, write email about libevent doc mistake (diff)
downloadglouglou-9b3419ecf4b2e149f9ef6e684dfdb15da6cddffd.tar.xz
glouglou-9b3419ecf4b2e149f9ef6e684dfdb15da6cddffd.zip
fix handling of name returned by evdns.
their documentation is wrong, i will send them an email.
-rw-r--r--libglouglou/libggnet_dns.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/libglouglou/libggnet_dns.c b/libglouglou/libggnet_dns.c
index be4e19b..26e0230 100644
--- a/libglouglou/libggnet_dns.c
+++ b/libglouglou/libggnet_dns.c
@@ -95,14 +95,20 @@ _cb_evdns_reverse(int result, char type, int count,
int ttl, void *addresses, void *arg)
{
struct ggnet_dns_req *req;
+ char **name;
req = arg;
if (type != DNS_PTR) {
- printf("libggnet_dns WARNING: dns reverse for %d received non DNS_PTR\n",
+ printf("libggnet_dns WARNING: dns reverse for %x received non DNS_PTR\n",
req->ip.s_addr);
goto free;
}
- req->cb_usr(&req->ip, addresses, req->data);
+ if (count == 0)
+ goto free;
+ if (count > 1)
+ printf("libggnet_dns XXX: has %d PTR records !\n", count); // XXX
+ name = addresses;
+ req->cb_usr(&req->ip, *name, req->data);
free:
LIST_REMOVE(req, entry);