From: Ulrich Drepper Date: Fri, 30 Jan 1998 17:11:30 +0000 (+0000) Subject: Convert hostname to lowercase for NIS query. X-Git-Tag: cvs/before-sparc-2_0_x-branch~255 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c81e60be9f39a6a5918877dc37fe0bbb805f49ad;p=thirdparty%2Fglibc.git Convert hostname to lowercase for NIS query. --- diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index f96c1f0b283..b6a63b1190f 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 , 1996. @@ -268,8 +268,21 @@ _nss_nis_gethostbyname2_r (const char *name, int af, struct hostent *host, __set_errno (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) {