about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2006-10-11 01:22:51 +0000
committerUlrich Drepper <drepper@redhat.com>2006-10-11 01:22:51 +0000
commitef4ae86af0e6c90d1f157b7af81b42b834286e45 (patch)
tree3dbc8d420a5ad4e74e696a0bab038a0a760ac7d2
parente2779f601298f4feffd3093f1b5ae45e49677bc4 (diff)
downloadglibc-ef4ae86af0e6c90d1f157b7af81b42b834286e45.tar.gz
glibc-ef4ae86af0e6c90d1f157b7af81b42b834286e45.tar.xz
glibc-ef4ae86af0e6c90d1f157b7af81b42b834286e45.zip
(nis_getnames): Make sure that we always return at least one entry consisting of the parameter concatenated with the domain.
-rw-r--r--nis/nis_subr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/nis/nis_subr.c b/nis/nis_subr.c
index 40c9270501..93e34f13cb 100644
--- a/nis/nis_subr.c
+++ b/nis/nis_subr.c
@@ -275,6 +275,13 @@ nis_getnames (const_nis_name name)
       cp = __strtok_r (NULL, ":", &saveptr);
     }
 
+  if (pos == 0
+      && __asprintf (&getnames[pos++], "%s%s%s%s",
+		     name, name[name_len - 1] == '.' ? "" : ".",
+		     local_domain,
+		     local_domain[local_domain_len - 1] == '.' ? "" : ".") < 0)
+    goto free_null;
+
   getnames[pos] = NULL;
 
   return getnames;