Return proper status from _nss_nis_initgroups_dyn (#1294574)

This commit is contained in:
Florian Weimer 2016-08-18 16:10:25 +02:00
parent 371b5ecb70
commit 18df09c331
2 changed files with 59 additions and 0 deletions

56
glibc-rh1294574.patch Normal file
View File

@ -0,0 +1,56 @@
commit a8c871a8714b968b1a1e3e679919a2125fc968f3
Author: Andreas Schwab <schwab@suse.de>
Date: Thu Jun 16 12:44:29 2016 +0200
Return proper status from _nss_nis_initgroups_dyn (bug 20262)
(cherry picked from commit 73fb56a4d51fd4437e4cde6dd3c8077a610f88a8)
diff --git a/nis/nss_nis/nis-initgroups.c b/nis/nss_nis/nis-initgroups.c
index ed5c26b..5845b6d 100644
--- a/nis/nss_nis/nis-initgroups.c
+++ b/nis/nss_nis/nis-initgroups.c
@@ -266,7 +266,7 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
tmpbuf = __alloca (buflen);
- do
+ while (1)
{
while ((status =
internal_getgrent_r (&grpbuf, tmpbuf, buflen, errnop,
@@ -275,8 +275,11 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
if (status != NSS_STATUS_SUCCESS)
- goto done;
-
+ {
+ if (status == NSS_STATUS_NOTFOUND)
+ status = NSS_STATUS_SUCCESS;
+ goto done;
+ }
g = &grpbuf;
if (g->gr_gid != group)
@@ -304,7 +307,11 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
newgroups = realloc (groups, newsize * sizeof (*groups));
if (newgroups == NULL)
- goto done;
+ {
+ status = NSS_STATUS_TRYAGAIN;
+ *errnop = errno;
+ goto done;
+ }
*groupsp = groups = newgroups;
*size = newsize;
}
@@ -316,7 +323,6 @@ _nss_nis_initgroups_dyn (const char *user, gid_t group, long int *start,
}
}
}
- while (status == NSS_STATUS_SUCCESS);
done:
while (intern.start != NULL)

View File

@ -274,6 +274,7 @@ Patch1053: glibc-build-time.patch
Patch1054: glibc-rh1352625.patch
Patch1055: glibc-rh1348620.patch
Patch1056: glibc-swbz20435.patch
Patch1057: glibc-rh1294574.patch
##############################################################################
#
@ -747,6 +748,7 @@ microbenchmark tests on the system.
%patch1054 -p1
%patch1055 -p1
%patch1056 -p1
%patch1057 -p1
%patch0059 -p1
##############################################################################
@ -1972,6 +1974,7 @@ rm -f *.filelist*
- Avoid duplicating object files already in libc.a (#1352625)
- malloc: Avoid premature fallback to mmap (#1348620)
- CVE-2016-6323: Backtraces can hang on ARM EABI (32-bit) (swbz#20435)
- Return proper status from _nss_nis_initgroups_dyn (#1294574)
* Thu Jun 2 2016 Florian Weimer <fweimer@redhat.com> - 2.22-17
- CVE-2016-4429: stack overflow in Sun RPC clntudp_call (#1337140)