diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-01-30 12:11:24 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-01-30 12:11:24 +0000 |
commit | cd897fe7c6c132e47d910d593ee330809d41d84a (patch) | |
tree | f54d47851804040555f7f387feb96dcb8c178d5a /nis | |
parent | 6591c3356242ba48627beb29345e4e44242c7068 (diff) | |
download | glibc-cd897fe7c6c132e47d910d593ee330809d41d84a.zip glibc-cd897fe7c6c132e47d910d593ee330809d41d84a.tar.gz glibc-cd897fe7c6c132e47d910d593ee330809d41d84a.tar.bz2 |
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.
Diffstat (limited to 'nis')
-rw-r--r-- | nis/nss_nis/nis-hosts.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/nis/nss_nis/nis-hosts.c b/nis/nss_nis/nis-hosts.c index c9d3551..9340fae 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) { |