On Tue, May 07, 2013 at 09:52:17AM +0200, Jakub Hrozek wrote:
This bug was found by Sumit. When I split resolv_get_sockaddr_address_index and resolv_get_sockaddr_address and actually didn't use the index parameter anywhere.
ACK, I only have I nano-nitpick, you might want to consider to rename index to addrindex in async_resolv.h as well, but this is purely cosmetically.
bye, Sumit
From 86bd021fb95b5cc73807ab6d73f82549616a0058 Mon Sep 17 00:00:00 2001 From: Jakub Hrozek jhrozek@redhat.com Date: Mon, 6 May 2013 15:10:22 +0200 Subject: [PATCH] Actually use the index parameter in resolv_get_sockaddr_address_index
src/resolv/async_resolv.c | 11 +++++++---- src/resolv/async_resolv.h | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/resolv/async_resolv.c b/src/resolv/async_resolv.c index 1eb0acf83cb5bb48d92a58b8baf872f4ca4d8278..ad9d58297d0701e2a48ef86179c93c71320654fb 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 9bf5e0c40e44c385858fa4d85adebe6e022ca006..dd8e9de50d235f461cdd39f10a7a1ebd7f5c3ccd 100644 --- a/src/resolv/async_resolv.h +++ b/src/resolv/async_resolv.h @@ -129,7 +129,8 @@ 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, +resolv_get_sockaddr_address_index(TALLOC_CTX *mem_ctx,
struct resolv_hostent *hostent, int port, int index);
#define resolv_get_sockaddr_address(mem_ctx, rhostent, port) \
1.8.2.1
sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel