about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-01-30 12:11:24 +0000
committerUlrich Drepper <drepper@redhat.com>1998-01-30 12:11:24 +0000
commitcd897fe7c6c132e47d910d593ee330809d41d84a (patch)
treef54d47851804040555f7f387feb96dcb8c178d5a
parent6591c3356242ba48627beb29345e4e44242c7068 (diff)
downloadglibc-cd897fe7c6c132e47d910d593ee330809d41d84a.tar.gz
glibc-cd897fe7c6c132e47d910d593ee330809d41d84a.tar.xz
glibc-cd897fe7c6c132e47d910d593ee330809d41d84a.zip
Convert hostname to lowercase for NIS query.
1998-01-30  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* nis/nss_nis/nis-hosts.c: Convert hostname to lowercase for NIS query.
-rw-r--r--ChangeLog4
-rw-r--r--nis/nss_nis/nis-hosts.c19
2 files changed, 20 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ffe27bf4e6..3c04365358 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+1998-01-30  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>
+
+	* nis/nss_nis/nis-hosts.c: Convert hostname to lowercase for NIS query.
+
 1998-01-30 19:58  Ulrich Drepper  <drepper@cygnus.com>
 
 	* include/cpio.h: Move to ...
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c
index c9d355171a..9340faecf8 100644
--- a/nis/nss_nis/nis-hosts.c
+++ b/nis/nss_nis/nis-hosts.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996.
 
@@ -259,8 +259,21 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host,
       *errnop = ERANGE;
       return NSS_STATUS_TRYAGAIN;
     }
-  retval = yperr2nss (yp_match (domain, "hosts.byname", name,
-                                strlen (name), &result, &len));
+  else
+    {
+      /* Convert name to lowercase.  */
+      size_t len = strlen (name);
+      char name2[len + 1];
+      int i;
+
+      for (i = 0; i < len; ++i)
+	name2[i] = tolower (name[i]);
+      name2[i] = '\0';
+
+      retval = yperr2nss (yp_match (domain, "hosts.byname", name2,
+				    len, &result, &len));
+
+    }
 
   if (retval != NSS_STATUS_SUCCESS)
     {