summary refs log tree commit diff
path: root/nss/nss_files
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nss_files')
-rw-r--r--nss/nss_files/files-alias.c5
-rw-r--r--nss/nss_files/files-hosts.c6
-rw-r--r--nss/nss_files/files-network.c4
-rw-r--r--nss/nss_files/files-parse.c14
-rw-r--r--nss/nss_files/files-service.c5
5 files changed, 24 insertions, 10 deletions
diff --git a/nss/nss_files/files-alias.c b/nss/nss_files/files-alias.c
index 733e599103..84d771d94e 100644
--- a/nss/nss_files/files-alias.c
+++ b/nss/nss_files/files-alias.c
@@ -1,5 +1,5 @@
 /* Mail alias 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.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
 
@@ -200,7 +200,8 @@ get_next_alias (const char *match, struct aliasent *result,
 	     looking for.  If it does not match we simply ignore all
 	     lines until the next line containing the start of a new
 	     alias is found.  */
-	  ignore = match != NULL && strcmp (result->alias_name, match) != 0;
+	  ignore = (match != NULL
+		    && strcasecmp (result->alias_name, match) != 0);
 
 	  while (! ignore)
 	    {
diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
index d6c4152507..2379919f49 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 ac5acd5c4e..8180d46e9d 100644
--- a/nss/nss_files/files-network.c
+++ b/nss/nss_files/files-network.c
@@ -1,5 +1,5 @@
 /* Networks 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
@@ -44,7 +44,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 76df1c6ff0..198b359b4c 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, int *errnop)
     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
diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
index 317b4fa9cc..186b8a27fc 100644
--- a/nss/nss_files/files-service.c
+++ b/nss/nss_files/files-service.c
@@ -39,7 +39,8 @@ LINE_PARSER
 
 #include GENERIC
 
-DB_LOOKUP (servbyname, 1 + strlen (name), (".%s/%s", name, proto),
+DB_LOOKUP (servbyname, 2 + strlen (name) + strlen (proto),
+	   (".%s/%s", name, proto),
 	   {
 	     /* Must match both protocol (if specified) and name.  */
 	     if (proto != NULL && strcmp (result->s_proto, proto))
@@ -48,7 +49,7 @@ DB_LOOKUP (servbyname, 1 + strlen (name), (".%s/%s", name, proto),
 	   },
 	   const char *name, const char *proto)
 
-DB_LOOKUP (servbyport, 20, ("=%d/%s", port, proto),
+DB_LOOKUP (servbyport, 21 + strlen (proto), ("=%d/%s", port, proto),
 	   {
 	     /* Must match both port and protocol.  */
 	     if (result->s_port == port