summary refs log tree commit diff
path: root/nss
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-15 09:42:45 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-15 09:42:45 +0000
commita7d248330fcfbd8c3ebaf13088d9d312895b7dc4 (patch)
tree80f31bbd8304e814a65ee0ccba040f985b051686 /nss
parent06ee3df6a87f61a5e3e8c4cf1d892b197352f96d (diff)
downloadglibc-a7d248330fcfbd8c3ebaf13088d9d312895b7dc4.tar.gz
glibc-a7d248330fcfbd8c3ebaf13088d9d312895b7dc4.tar.xz
glibc-a7d248330fcfbd8c3ebaf13088d9d312895b7dc4.zip
Update.
2004-08-15  Ulrich Drepper  <drepper@redhat.com>

	* nss/getent.c: Allow queries for getaddrinfo with AF_INET and
	AF_INET6.
Diffstat (limited to 'nss')
-rw-r--r--nss/getent.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/nss/getent.c b/nss/getent.c
index 4be9535b9d..0f93e5121c 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -295,7 +295,7 @@ hosts_keys (int number, char *key[])
 
 /* This is for hosts, but using getaddrinfo */
 static int
-ahosts_keys (int number, char *key[])
+ahosts_keys_int (int af, int xflags, int number, char *key[])
 {
   int result = 0;
   int i;
@@ -312,8 +312,8 @@ ahosts_keys (int number, char *key[])
 
   struct addrinfo hint;
   memset (&hint, '\0', sizeof (hint));
-  hint.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME;
-  hint.ai_family = AF_UNSPEC;
+  hint.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | AI_CANONNAME | xflags;
+  hint.ai_family = af;
 
   for (i = 0; i < number; ++i)
     {
@@ -360,6 +360,24 @@ ahosts_keys (int number, char *key[])
   return result;
 }
 
+static int
+ahosts_keys (int number, char *key[])
+{
+  return ahosts_keys_int (AF_UNSPEC, 0, number, key);
+}
+
+static int
+ahostsv4_keys (int number, char *key[])
+{
+  return ahosts_keys_int (AF_INET, 0, number, key);
+}
+
+static int
+ahostsv6_keys (int number, char *key[])
+{
+  return ahosts_keys_int (AF_INET6, AI_V4MAPPED, number, key);
+}
+
 /* This is for netgroup */
 static int
 netgroup_keys (int number, char *key[])
@@ -715,6 +733,8 @@ struct
   {
 #define D(name) { #name, name ## _keys },
 D(ahosts)
+D(ahostsv4)
+D(ahostsv6)
 D(aliases)
 D(ethers)
 D(group)