summaryrefslogtreecommitdiffstats
path: root/src/resolv
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-05-06 15:10:22 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-05-07 14:13:54 +0200
commit7c091610f5b35e8ba89da839322f6591f1e7619b (patch)
tree809ff0b87039321e229eebb3578f65fe07c4a0c9 /src/resolv
parent4cdaf239d4504966bed8ecd5e3fa07def74c7302 (diff)
downloadsssd-7c091610f5b35e8ba89da839322f6591f1e7619b.tar.gz
sssd-7c091610f5b35e8ba89da839322f6591f1e7619b.tar.xz
sssd-7c091610f5b35e8ba89da839322f6591f1e7619b.zip
Actually use the index parameter in resolv_get_sockaddr_address_index
Diffstat (limited to 'src/resolv')
-rw-r--r--src/resolv/async_resolv.c11
-rw-r--r--src/resolv/async_resolv.h5
2 files changed, 10 insertions, 6 deletions
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c
index 1eb0acf83..ad9d58297 100644
--- a/src/resolv/async_resolv.c
+++ b/src/resolv/async_resolv.c
@@ -1453,8 +1453,9 @@ resolv_get_string_ptr_address(TALLOC_CTX *mem_ctx,
}
struct sockaddr_storage *
-resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent,
- int port, int index)
+resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx,
+ struct resolv_hostent *hostent,
+ int port, int addrindex)
{
struct sockaddr_storage *sockaddr;
@@ -1470,14 +1471,16 @@ resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx, struct resolv_hostent *ho
case AF_INET:
sockaddr->ss_family = AF_INET;
memcpy(&((struct sockaddr_in *) sockaddr)->sin_addr,
- hostent->addr_list[0]->ipaddr, sizeof(struct in_addr));
+ hostent->addr_list[addrindex]->ipaddr,
+ sizeof(struct in_addr));
((struct sockaddr_in *) sockaddr)->sin_port = (in_port_t) htons(port);
break;
case AF_INET6:
sockaddr->ss_family = AF_INET6;
memcpy(&((struct sockaddr_in6 *) sockaddr)->sin6_addr,
- hostent->addr_list[0]->ipaddr, sizeof(struct in6_addr));
+ hostent->addr_list[addrindex]->ipaddr,
+ sizeof(struct in6_addr));
((struct sockaddr_in6 *) sockaddr)->sin6_port = (in_port_t) htons(port);
break;
default:
diff --git a/src/resolv/async_resolv.h b/src/resolv/async_resolv.h
index 9bf5e0c40..a8207884c 100644
--- a/src/resolv/async_resolv.h
+++ b/src/resolv/async_resolv.h
@@ -129,8 +129,9 @@ resolv_get_string_ptr_address(TALLOC_CTX *mem_ctx,
resolv_get_string_address_index(mem_ctx, hostent, 0)
struct sockaddr_storage *
-resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx, struct resolv_hostent *hostent,
- int port, int index);
+resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx,
+ struct resolv_hostent *hostent,
+ int port, int addrindex);
#define resolv_get_sockaddr_address(mem_ctx, rhostent, port) \
resolv_get_sockaddr_address_index(mem_ctx, rhostent, port, 0)