about summary refs log tree commit diff
path: root/nis/nss_nisplus/nisplus-grp.c
diff options
context:
space:
mode:
Diffstat (limited to 'nis/nss_nisplus/nisplus-grp.c')
-rw-r--r--nis/nss_nisplus/nisplus-grp.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/nis/nss_nisplus/nisplus-grp.c b/nis/nss_nisplus/nisplus-grp.c
index f66c14f8ed..daca94fc87 100644
--- a/nis/nss_nisplus/nisplus-grp.c
+++ b/nis/nss_nisplus/nisplus-grp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2001, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2001, 2002, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
 
@@ -72,11 +72,19 @@ internal_setgrent (void)
       return NSS_STATUS_UNAVAIL;
 
   result = nis_list (tablename_val, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
-  status = niserr2nss (result->status);
-  if (status != NSS_STATUS_SUCCESS)
+  if (result == NULL)
     {
-      nis_freeresult (result);
-      result = NULL;
+      status = NSS_STATUS_TRYAGAIN;
+      __set_errno (ENOMEM);
+    }
+  else
+    {
+      status = niserr2nss (result->status);
+      if (status != NSS_STATUS_SUCCESS)
+	{
+	  nis_freeresult (result);
+	  result = NULL;
+	}
     }
   return status;
 }
@@ -186,6 +194,11 @@ _nss_nisplus_getgrnam_r (const char *name, struct group *gr,
 
       result = nis_list (buf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
 
+      if (result == NULL)
+	{
+	  *errnop = ENOMEM;
+	  return NSS_STATUS_TRYAGAIN;
+	}
       if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
 	{
 	  enum nss_status status = niserr2nss (result->status);
@@ -236,6 +249,11 @@ _nss_nisplus_getgrgid_r (const gid_t gid, struct group *gr,
 
     result = nis_list (buf, FOLLOW_PATH | FOLLOW_LINKS, NULL, NULL);
 
+    if (result == NULL)
+      {
+	*errnop = ENOMEM;
+	return NSS_STATUS_TRYAGAIN;
+      }
     if (niserr2nss (result->status) != NSS_STATUS_SUCCESS)
       {
 	enum nss_status status = niserr2nss (result->status);