|
|
147e83 |
commit 58b930ae216bfa98cd60212b954b07b9963d6d04
|
|
|
147e83 |
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
|
|
|
147e83 |
Date: Wed Sep 10 21:51:50 2014 +0530
|
|
|
147e83 |
|
|
|
147e83 |
Return failure in getnetgrent only when all netgroups have been searched (#17363)
|
|
|
147e83 |
|
|
|
147e83 |
The netgroups lookup code fails when one of the groups in the search
|
|
|
147e83 |
tree is empty. In such a case it only returns the leaves of the tree
|
|
|
147e83 |
after the blank netgroup. This is because the line parser returns a
|
|
|
147e83 |
NOTFOUND status when the netgroup exists but is empty. The
|
|
|
147e83 |
__getnetgrent_internal implementation needs to be fixed to try
|
|
|
147e83 |
remaining groups if the current group is entry. This patch implements
|
|
|
147e83 |
this fix. Tested on x86_64.
|
|
|
147e83 |
|
|
|
147e83 |
[BZ #17363]
|
|
|
147e83 |
* inet/getnetgrent_r.c (__internal_getnetgrent_r): Try next
|
|
|
147e83 |
group if the current group is empty.
|
|
|
147e83 |
|
|
|
147e83 |
diff --git glibc-2.17-c758a686/inet/getnetgrent_r.c glibc-2.17-c758a686/inet/getnetgrent_r.c
|
|
|
147e83 |
index f6d064d..e101537 100644
|
|
|
147e83 |
--- glibc-2.17-c758a686/inet/getnetgrent_r.c
|
|
|
147e83 |
+++ glibc-2.17-c758a686/inet/getnetgrent_r.c
|
|
|
147e83 |
@@ -297,7 +297,10 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp,
|
|
|
147e83 |
{
|
|
|
147e83 |
status = DL_CALL_FCT (*fct, (datap, buffer, buflen, &errno));
|
|
|
147e83 |
|
|
|
147e83 |
- if (status == NSS_STATUS_RETURN)
|
|
|
147e83 |
+ if (status == NSS_STATUS_RETURN
|
|
|
147e83 |
+ /* The service returned a NOTFOUND, but there are more groups that we
|
|
|
147e83 |
+ need to resolve before we give up. */
|
|
|
147e83 |
+ || (status == NSS_STATUS_NOTFOUND && datap->needed_groups != NULL))
|
|
|
147e83 |
{
|
|
|
147e83 |
/* This was the last one for this group. Look at next group
|
|
|
147e83 |
if available. */
|