Skip to content

Commit

Permalink
Return failure in getnetgrent only when all netgroups have been searc…
Browse files Browse the repository at this point in the history
…hed (#17363)

The netgroups lookup code fails when one of the groups in the search
tree is empty.  In such a case it only returns the leaves of the tree
after the blank netgroup.  This is because the line parser returns a
NOTFOUND status when the netgroup exists but is empty.  The
__getnetgrent_internal implementation needs to be fixed to try
remaining groups if the current group is entry.  This patch implements
this fix.  Tested on x86_64.

	[BZ #17363]
	* inet/getnetgrent_r.c (__internal_getnetgrent_r): Try next
	group if the current group is empty.
  • Loading branch information
Siddhesh Poyarekar committed Sep 10, 2014
1 parent 71ae864 commit 58b930a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
2014-09-10 Siddhesh Poyarekar <siddhesh@redhat.com>

[BZ #17363]
* inet/getnetgrent_r.c (__internal_getnetgrent_r): Try next
group if the current group is empty.

2014-09-10 Adhemerval Zanella <azanella@linux.vnet.ibm.com>

* benchtests/bench-memset.c (test_main): Add more test from size
Expand Down
6 changes: 6 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ See the end for copying conditions.
Please send GNU C library bug reports via <http://sourceware.org/bugzilla/>
using `glibc' in the "product" field.

Version 2.21

* The following bugs are resolved with this release:

17363.

Version 2.20

* The following bugs are resolved with this release:
Expand Down
5 changes: 4 additions & 1 deletion inet/getnetgrent_r.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,10 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
{
status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno));

if (status == NSS_STATUS_RETURN)
if (status == NSS_STATUS_RETURN
/* The service returned a NOTFOUND, but there are more groups that we
need to resolve before we give up. */
|| (status == NSS_STATUS_NOTFOUND && datap->needed_groups != NULL))
{
/* This was the last one for this group. Look at next group
if available. */
Expand Down

0 comments on commit 58b930a

Please sign in to comment.