about summary refs log tree commit diff
path: root/grp
diff options
context:
space:
mode:
Diffstat (limited to 'grp')
-rw-r--r--grp/initgroups.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/grp/initgroups.c b/grp/initgroups.c
index f42c92db9a..454882e0af 100644
--- a/grp/initgroups.c
+++ b/grp/initgroups.c
@@ -59,12 +59,18 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
   get_function getgrent_fct;
   end_function endgrent_fct;
 
+  getgrent_fct = __nss_lookup_function (nip, "getgrent_r");
+  if (getgrent_fct == NULL)
+    return NSS_STATUS_UNAVAIL;
+
   setgrent_fct = __nss_lookup_function (nip, "setgrent");
-  status = _CALL_DL_FCT (setgrent_fct, ());
-  if (status != NSS_STATUS_SUCCESS)
-    return status;
+  if (setgrent_fct)
+    {
+      status = _CALL_DL_FCT (setgrent_fct, ());
+      if (status != NSS_STATUS_SUCCESS)
+	return status;
+    }
 
-  getgrent_fct = __nss_lookup_function (nip, "getgrent_r");
   endgrent_fct = __nss_lookup_function (nip, "endgrent");
 
   tmpbuf = __alloca (buflen);
@@ -115,7 +121,8 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
   while (status == NSS_STATUS_SUCCESS);
 
  done:
-  _CALL_DL_FCT (endgrent_fct, ());
+  if (endgrent_fct)
+    _CALL_DL_FCT (endgrent_fct, ());
 
   return NSS_STATUS_SUCCESS;
 }