[SCM] NSS Wrapper Repository - branch master updated
Andreas Schneider
asn at samba.org
Wed Mar 19 04:13:01 MDT 2014
The branch, master has been updated
via cf26c91 tests: Add test that getaddrinfo() returns the IPv6 address.
via 8a606d6 src: Fix looking up a fqdn with getaddrinfo().
from 19426f4 tests: Add test for gethostbyname2().
http://gitweb.samba.org/?p=nss_wrapper.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit cf26c9167f4d30e0cd73bcdd664306d7b71127f6
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 18 09:00:36 2014 +0100
tests: Add test that getaddrinfo() returns the IPv6 address.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
commit 8a606d69eb93076fe7824ffb90d6dc6b6ee9f7ee
Author: Andreas Schneider <asn at samba.org>
Date: Tue Mar 18 08:43:21 2014 +0100
src: Fix looking up a fqdn with getaddrinfo().
This fixes 'getent ahostsv6'.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Stefan Metzmacher <metze at samba.org>
-----------------------------------------------------------------------
Summary of changes:
src/nss_wrapper.c | 2 +-
tests/test_getaddrinfo.c | 32 ++++++++++++++++++++++++++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 2706196..d70dfb6 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -3948,7 +3948,7 @@ static int nwrap_getaddrinfo(const char *node,
}
#endif
} else {
- he = nwrap_files_gethostbyname(node, AF_UNSPEC);
+ he = nwrap_files_gethostbyname(node, hints->ai_family);
if (he != NULL) {
rc = nwrap_convert_he_ai(he, port, hints, &ai);
eai = rc;
diff --git a/tests/test_getaddrinfo.c b/tests/test_getaddrinfo.c
index 4825e77..724e970 100644
--- a/tests/test_getaddrinfo.c
+++ b/tests/test_getaddrinfo.c
@@ -307,6 +307,37 @@ static void test_nwrap_getaddrinfo_null(void **state)
freeaddrinfo(res);
}
+static void test_nwrap_getaddrinfo_ipv6(void **state)
+{
+ struct addrinfo hints;
+ struct addrinfo *res = NULL;
+ struct sockaddr_in6 *sin6p;
+ char ip6[INET6_ADDRSTRLEN];
+ int rc;
+
+ (void) state; /* unused */
+
+ /*
+ * krikkit.galaxy has an IPv4 and IPv6 address, this should only
+ * return the IPv6 address.
+ */
+ memset(&hints, 0, sizeof(struct addrinfo));
+ hints.ai_family = AF_INET6;
+
+ rc = getaddrinfo("krikkit.galaxy.site", NULL, &hints, &res);
+ assert_int_equal(rc, 0);
+
+ assert_non_null(res->ai_next);
+ assert_int_equal(res->ai_family, AF_INET6);
+
+ sin6p = (struct sockaddr_in6 *)res->ai_addr;
+ inet_ntop(AF_INET6, (void *)&sin6p->sin6_addr, ip6, sizeof(ip6));
+
+ assert_string_equal(ip6, "::14");
+
+ freeaddrinfo(res);
+}
+
int main(void) {
int rc;
@@ -317,6 +348,7 @@ int main(void) {
unit_test(test_nwrap_getaddrinfo_name),
unit_test(test_nwrap_getaddrinfo_service),
unit_test(test_nwrap_getaddrinfo_null),
+ unit_test(test_nwrap_getaddrinfo_ipv6),
};
rc = run_tests(tests);
--
NSS Wrapper Repository
More information about the samba-cvs
mailing list