From 9b3419ecf4b2e149f9ef6e684dfdb15da6cddffd Mon Sep 17 00:00:00 2001 From: Laurent Ghigonis Date: Sat, 15 Dec 2012 05:24:40 +0100 Subject: fix handling of name returned by evdns. their documentation is wrong, i will send them an email. --- libglouglou/libggnet_dns.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libglouglou/libggnet_dns.c') 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); -- cgit v1.2.3-59-g8ed1b