about summary refs log tree commit diff
path: root/nis
diff options
context:
space:
mode:
Diffstat (limited to 'nis')
-rw-r--r--nis/Versions9
-rw-r--r--nis/nss_compat/compat-initgroups.c18
-rw-r--r--nis/nss_nis/nis-initgroups.c18
3 files changed, 22 insertions, 23 deletions
diff --git a/nis/Versions b/nis/Versions
index ec8ade0dd3..8bcf9a8f0e 100644
--- a/nis/Versions
+++ b/nis/Versions
@@ -64,9 +64,12 @@ libnss_compat {
     _nss_compat_endgrent; _nss_compat_endpwent; _nss_compat_endspent;
     _nss_compat_getgrent_r; _nss_compat_getgrgid_r; _nss_compat_getgrnam_r;
     _nss_compat_getpwent_r; _nss_compat_getpwnam_r; _nss_compat_getpwuid_r;
-    _nss_compat_getspent_r; _nss_compat_getspnam_r; _nss_compat_initgroups;
+    _nss_compat_getspent_r; _nss_compat_getspnam_r;
     _nss_compat_setgrent; _nss_compat_setpwent; _nss_compat_setspent;
   }
+  GLIBC_2.2 {
+    _nss_compat_initgroups_dyn;
+  }
 }
 
 libnss_nis {
@@ -85,14 +88,14 @@ libnss_nis {
     _nss_nis_getpwnam_r; _nss_nis_getpwuid_r; _nss_nis_getrpcbyname_r;
     _nss_nis_getrpcbynumber_r; _nss_nis_getrpcent_r; _nss_nis_getsecretkey;
     _nss_nis_getservbyname_r; _nss_nis_getservbyport_r; _nss_nis_getservent_r;
-    _nss_nis_getspent_r; _nss_nis_getspnam_r; _nss_nis_initgroups;
+    _nss_nis_getspent_r; _nss_nis_getspnam_r;
     _nss_nis_netname2user; _nss_nis_setaliasent; _nss_nis_setetherent;
     _nss_nis_setgrent; _nss_nis_sethostent; _nss_nis_setnetent;
     _nss_nis_setnetgrent; _nss_nis_setprotoent; _nss_nis_setpwent;
     _nss_nis_setrpcent; _nss_nis_setservent; _nss_nis_setspent;
   }
   GLIBC_2.2 {
-    _nss_nis_getipnodebyname_r;
+    _nss_nis_getipnodebyname_r; _nss_nis_initgroups_dyn;
   }
 }
 
diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
index 6051a1ae99..4d14615126 100644
--- a/nis/nss_compat/compat-initgroups.c
+++ b/nis/nss_compat/compat-initgroups.c
@@ -588,15 +588,15 @@ internal_getgrent_r (struct group *gr, ent_t *ent, char *buffer,
 }
 
 enum nss_status
-_nss_compat_initgroups (const char *user, gid_t group, long int *start,
-			long int *size, gid_t *groups, long int limit,
-			int *errnop)
+_nss_compat_initgroups_dyn (const char *user, gid_t group, long int *start,
+			    long int *size, gid_t **groupsp, int *errnop)
 {
   struct group grpbuf, *g;
   size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
   char *tmpbuf;
   enum nss_status status;
   ent_t intern = {0, 0, NULL, 0, NULL, NULL, {NULL, 0, 0}};
+  gid_t *groups = *groupsp;
 
   status = internal_setgrent (&intern);
   if (status != NSS_STATUS_SUCCESS)
@@ -627,22 +627,20 @@ _nss_compat_initgroups (const char *user, gid_t group, long int *start,
             if (strcmp (*m, user) == 0)
               {
                 /* Matches user.  Insert this group.  */
-                if (*start == *size && limit <= 0)
+                if (*start == *size)
                   {
                     /* Need a bigger buffer.  */
-                    groups = realloc (groups, 2 * *size * sizeof (*groups));
-                    if (groups == NULL)
+		    gid_t *newgroups;
+                    newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+                    if (newgroups == NULL)
                       goto done;
+		    *groupsp = groups = newgroups;
                     *size *= 2;
                   }
 
                 groups[*start] = g->gr_gid;
                 *start += 1;
 
-                if (*start == limit)
-                  /* Can't take any more groups; stop searching.  */
-                  goto done;
-
                 break;
               }
         }
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index 9e18a2027a..ec13dbd140 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -137,15 +137,15 @@ internal_getgrent_r (struct group *grp, char *buffer, size_t buflen,
 }
 
 enum nss_status
-_nss_nis_initgroups (const char *user, gid_t group, long int *start,
-		     long int *size, gid_t *groups, long int limit,
-		     int *errnop)
+_nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
+			 long int *size, gid_t **groupsp, int *errnop)
 {
   struct group grpbuf, *g;
   size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
   char *tmpbuf;
   enum nss_status status;
   intern_t intern = { NULL, NULL };
+  gid_t *groups = *groupsp;
 
   status = internal_setgrent (&intern);
   if (status != NSS_STATUS_SUCCESS)
@@ -177,22 +177,20 @@ _nss_nis_initgroups (const char *user, gid_t group, long int *start,
             if (strcmp (*m, user) == 0)
               {
                 /* Matches user.  Insert this group.  */
-                if (*start == *size && limit <= 0)
+                if (*start == *size)
                   {
                     /* Need a bigger buffer.  */
-		    groups = realloc (groups, 2 * *size * sizeof (*groups));
-		    if (groups == NULL)
+		    gid_t *newgroups;
+		    newgroups = realloc (groups, 2 * *size * sizeof (*groups));
+		    if (newgroups == NULL)
 		      goto done;
+		    *groupsp = groups = newgroups;
                     *size *= 2;
                   }
 
                 groups[*start] = g->gr_gid;
 		*start += 1;
 
-                if (*start == limit)
-                  /* Can't take any more groups; stop searching.  */
-                  goto done;
-
                 break;
               }
         }