summaryrefslogtreecommitdiffstats
path: root/src/resolv/async_resolv.c
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-06-30 23:35:35 +0200
committerStephen Gallagher <sgallagh@redhat.com>2011-07-11 16:52:52 -0400
commit19c6d0bf5346dc1862d14f7f3d886895cfb4d548 (patch)
tree2635f201f7ab2ee115d671a12e8ca7790fddb8e4 /src/resolv/async_resolv.c
parent3136a82b9d76283b10244a9768e1f325503995d5 (diff)
downloadsssd-19c6d0bf5346dc1862d14f7f3d886895cfb4d548.tar.gz
sssd-19c6d0bf5346dc1862d14f7f3d886895cfb4d548.tar.xz
sssd-19c6d0bf5346dc1862d14f7f3d886895cfb4d548.zip
Allow returning arbitrary address from resolv_hostent as string
Diffstat (limited to 'src/resolv/async_resolv.c')
-rw-r--r--src/resolv/async_resolv.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c
index 4cbb56d82..ef76f1711 100644
--- a/src/resolv/async_resolv.c
+++ b/src/resolv/async_resolv.c
@@ -1314,7 +1314,9 @@ resolv_gethostbyname_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
}
char *
-resolv_get_string_address(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent)
+resolv_get_string_address_index(TALLOC_CTX *mem_ctx,
+ struct resolv_hostent *hostent,
+ unsigned int addrindex)
{
char *address;
@@ -1327,7 +1329,7 @@ resolv_get_string_address(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent)
}
errno = 0;
- if (inet_ntop(hostent->family, hostent->addr_list[0]->ipaddr,
+ if (inet_ntop(hostent->family, hostent->addr_list[addrindex]->ipaddr,
address, 128) == NULL) {
DEBUG(1, ("inet_ntop failed [%d][%s].\n", errno, strerror(errno)));
talloc_free(address);