From f140c3a0e52c41d0f4b6d4ecf126a2344e1f691d Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Thu, 2 Jun 2011 15:36:29 +0000 Subject: [PATCH] * NEWS, libmisc/addgrps.c: Fix allocator loop. Continue to getgroups() when getgroups fails (-1) with errno==EINVAL. --- ChangeLog | 5 +++++ NEWS | 4 ++++ libmisc/addgrps.c | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1136c4ac..b8dbad05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-06-02 Cal Peake + + * NEWS, libmisc/addgrps.c: Fix allocator loop. Continue to + getgroups() when getgroups fails (-1) with errno==EINVAL. + 2011-06-01 Simon Brandmair * man/newusers.8.xml, man/suauth.5.xml, man/suauth.5.xml, diff --git a/NEWS b/NEWS index 8be05e90..d6698c76 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,8 @@ shadow-4.1.4.3 -> shadow-4.1.5 UNRELEASED enabled versions only) * Fixed infinite loop when CONSOLE is configured with a colon-separated list of TTYs. + * Fixed warning and support for CONSOLE_GROUPS for users member of more + than 16 groups. - su * Document the su exit values. * When su receives a signal, wait for the child to terminate (after @@ -35,6 +37,8 @@ shadow-4.1.4.3 -> shadow-4.1.5 UNRELEASED * Default ENV_SUPATH is /sbin:/bin:/usr/sbin:/usr/bin * Fixed infinite loop when CONSOLE is configured with a colon-separated list of TTYs. + * Fixed warning and support for CONSOLE_GROUPS for users member of more + than 16 groups. - newgrp, sg, groupmems * Fix parsing of gshadow entries. - useradd diff --git a/libmisc/addgrps.c b/libmisc/addgrps.c index 1d0356fa..40fad994 100644 --- a/libmisc/addgrps.c +++ b/libmisc/addgrps.c @@ -71,7 +71,11 @@ int add_groups (const char *list) return -1; } ngroups = getgroups (i, grouplist); - if ((-1 == ngroups) || (i > (size_t)ngroups)) { + if ( ( (-1 == ngroups) + && (EINVAL != errno)) + || (i > (size_t)ngroups)) { + /* Unexpected failure of getgroups or successful + * reception of the groups */ break; } /* not enough room, so try allocating a larger buffer */