]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blame - src/patches/glibc/glibc-rh966778.patch
glibc: Backport hotfixes from RHEL6.
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh966778.patch
CommitLineData
f2b22ab7
MT
1commit 3056dcdb783a177158a5617657d1a33f872358d6
2Author: Ulrich Drepper <drepper@redhat.com>
3Date: Mon Nov 22 11:11:24 2010 -0500
4
5 Fix multiple nss_compat initgroups() bugs
6
7 Compat initgroups() is completely broken; the code will always set
8 skip_initgroups_dyn to true, so initgroups() will never be actually
9 called, but due to the nature of the code, setgrent() won't be called
10 either - thus, subsequent invocations of initgroups() will not return
11 the NIS group list anymore.
12
13 This is a simple patch that makes sure skip_initgroups_dyn is set only
14 in case initgroups is not available; it also attempts to handle the
15 unavailability of other NSS interfaces better.
16
17 Conflicts:
18
19 ChangeLog
20
21diff --git a/nis/nss_compat/compat-initgroups.c b/nis/nss_compat/compat-initgroups.c
22index 07a3b92..de8d95c 100644
23--- a/nis/nss_compat/compat-initgroups.c
24+++ b/nis/nss_compat/compat-initgroups.c
25@@ -474,18 +474,21 @@ internal_getgrent_r (ent_t *ent, char *buffer, size_t buflen, const char *user,
26 /* If the selected module does not support getgrent_r or
27 initgroups_dyn, abort. We cannot find the needed group
28 entries. */
29- if (nss_getgrent_r == NULL && nss_initgroups_dyn == NULL)
30+ if (nss_initgroups_dyn == NULL || nss_getgrgid_r == NULL)
31+ {
32+ if (nss_setgrent != NULL)
33+ {
34+ nss_setgrent (1);
35+ ent->need_endgrent = true;
36+ }
37+ ent->skip_initgroups_dyn = true;
38+ }
39+
40+ if (ent->skip_initgroups_dyn && nss_getgrent_r == NULL)
41 return NSS_STATUS_UNAVAIL;
42
43 ent->files = false;
44
45- if (nss_initgroups_dyn == NULL && nss_setgrent != NULL)
46- {
47- nss_setgrent (1);
48- ent->need_endgrent = true;
49- }
50- ent->skip_initgroups_dyn = true;
51-
52 return getgrent_next_nss (ent, buffer, buflen, user, group,
53 start, size, groupsp, limit, errnop);
54 }