From: Ulrich Drepper Date: Fri, 30 Jan 1998 17:16:16 +0000 (+0000) Subject: Do lookups ignoring case. X-Git-Tag: cvs/before-sparc-2_0_x-branch~249 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=284defebd505d0d2a4fb1a927c370160cdc7428f;p=thirdparty%2Fglibc.git Do lookups ignoring case. --- diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index d6c41525072..2379919f497 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -1,5 +1,5 @@ /* Hosts file parser in nss_files module. - 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. The GNU C Library is free software; you can redistribute it and/or @@ -89,14 +89,14 @@ DB_LOOKUP (hostbyname, ,, if (result->h_addrtype != ((_res.options & RES_USE_INET6) ? AF_INET6 : AF_INET)) continue; - LOOKUP_NAME (h_name, h_aliases) + LOOKUP_NAME_CASE (h_name, h_aliases) }, const char *name) DB_LOOKUP (hostbyname2, ,, { if (result->h_addrtype != af) continue; - LOOKUP_NAME (h_name, h_aliases) + LOOKUP_NAME_CASE (h_name, h_aliases) }, const char *name, int af) DB_LOOKUP (hostbyaddr, ,, diff --git a/nss/nss_files/files-network.c b/nss/nss_files/files-network.c index 081ac1a4439..8bf9c04adfb 100644 --- a/nss/nss_files/files-network.c +++ b/nss/nss_files/files-network.c @@ -45,7 +45,7 @@ LINE_PARSER #include "files-XXX.c" DB_LOOKUP (netbyname, ,, - LOOKUP_NAME (n_name, n_aliases), + LOOKUP_NAME_CASE (n_name, n_aliases), const char *name) DB_LOOKUP (netbyaddr, ,, diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c index acf673da900..2903c2ba898 100644 --- a/nss/nss_files/files-parse.c +++ b/nss/nss_files/files-parse.c @@ -1,5 +1,5 @@ /* Common code for file-based database parsers in nss_files module. - 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. The GNU C Library is free software; you can redistribute it and/or @@ -232,6 +232,18 @@ parse_list (char *line, struct parser_data *data, size_t datalen) break; \ } +#define LOOKUP_NAME_CASE(nameelt, aliaselt) \ +{ \ + char **ap; \ + if (! __strcasecmp (name, result->nameelt)) \ + break; \ + for (ap = result->aliaselt; *ap; ++ap) \ + if (! __strcasecmp (name, *ap)) \ + break; \ + if (*ap) \ + break; \ +} + /* This is defined by db-*.c to include "../nss_db/db-XXX.c" instead. */ #ifndef GENERIC