From cd897fe7c6c132e47d910d593ee330809d41d84a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 30 Jan 1998 12:11:24 +0000 Subject: Convert hostname to lowercase for NIS query. 1998-01-30 Thorsten Kukuk * nis/nss_nis/nis-hosts.c: Convert hostname to lowercase for NIS query. --- nis/nss_nis/nis-hosts.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'nis/nss_nis') 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 , 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) { -- cgit v1.2.3