]>
Commit | Line | Data |
---|---|---|
bb330e25 AF |
1 | commit 58b930ae216bfa98cd60212b954b07b9963d6d04 |
2 | Author: Siddhesh Poyarekar <siddhesh@redhat.com> | |
3 | Date: Wed Sep 10 21:51:50 2014 +0530 | |
4 | ||
5 | Return failure in getnetgrent only when all netgroups have been searched (#17363) | |
6 | ||
7 | The netgroups lookup code fails when one of the groups in the search | |
8 | tree is empty. In such a case it only returns the leaves of the tree | |
9 | after the blank netgroup. This is because the line parser returns a | |
10 | NOTFOUND status when the netgroup exists but is empty. The | |
11 | __getnetgrent_internal implementation needs to be fixed to try | |
12 | remaining groups if the current group is entry. This patch implements | |
13 | this fix. Tested on x86_64. | |
14 | ||
15 | [BZ #17363] | |
16 | * inet/getnetgrent_r.c (__internal_getnetgrent_r): Try next | |
17 | group if the current group is empty. | |
18 | ||
19 | diff --git a/inet/getnetgrent_r.c b/inet/getnetgrent_r.c | |
20 | index f6d064d..e101537 100644 | |
21 | --- a/inet/getnetgrent_r.c | |
22 | +++ b/inet/getnetgrent_r.c | |
23 | @@ -297,7 +297,10 @@ __internal_getnetgrent_r (char **hostp, char **userp, char **domainp, | |
24 | { | |
25 | status = (*fct) (datap, buffer, buflen, &errno); | |
26 | ||
27 | - if (status == NSS_STATUS_RETURN) | |
28 | + if (status == NSS_STATUS_RETURN | |
29 | + /* The service returned a NOTFOUND, but there are more groups that we | |
30 | + need to resolve before we give up. */ | |
31 | + || (status == NSS_STATUS_NOTFOUND && datap->needed_groups != NULL)) | |
32 | { | |
33 | /* This was the last one for this group. Look at next group | |
34 | if available. */ |