(nis_getnames): Make sure that we always return at least one entry
authordrepper <drepper>
Wed, 11 Oct 2006 01:22:51 +0000 (01:22 +0000)
committerdrepper <drepper>
Wed, 11 Oct 2006 01:22:51 +0000 (01:22 +0000)
consisting of the parameter concatenated with the domain.

nis/nis_subr.c

index 40c9270..93e34f1 100644 (file)
@@ -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;