From 18df09c331e8466b7a4a7feacd350f227d20c4ec Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Thu, 18 Aug 2016 16:10:25 +0200 Subject: [PATCH] Return proper status from _nss_nis_initgroups_dyn (#1294574) --- glibc-rh1294574.patch | 56 +++++++++++++++++++++++++++++++++++++++++++ glibc.spec | 3 +++ 2 files changed, 59 insertions(+) create mode 100644 glibc-rh1294574.patch diff --git a/glibc-rh1294574.patch b/glibc-rh1294574.patch new file mode 100644 index 0000000..806b7c7 --- /dev/null +++ b/glibc-rh1294574.patch @@ -0,0 +1,56 @@ +commit a8c871a8714b968b1a1e3e679919a2125fc968f3 +Author: Andreas Schwab +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) diff --git a/glibc.spec b/glibc.spec index 309bb6c..124fdf4 100644 --- a/glibc.spec +++ b/glibc.spec @@ -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 - 2.22-17 - CVE-2016-4429: stack overflow in Sun RPC clntudp_call (#1337140)