]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc/glibc-rh718057.patch
dhcpcd: fix delay after dhcp down.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh718057.patch
CommitLineData
12788f63
MT
12011-07-01 Andreas Schwab <schwab@redhat.com>
2
3 * nis/nss_compat/compat-pwd.c (getpwent_next_nss_netgr): Query NIS
4 domain only when needed.
5
6Index: glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-pwd.c
7===================================================================
8--- glibc-2.12-2-gc4ccff1.orig/nis/nss_compat/compat-pwd.c
9+++ glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-pwd.c
10@@ -360,7 +360,7 @@ getpwent_next_nss_netgr (const char *nam
11 char *group, char *buffer, size_t buflen,
12 int *errnop)
13 {
14- char *curdomain, *host, *user, *domain, *p2;
15+ char *curdomain = NULL, *host, *user, *domain, *p2;
16 int status;
17 size_t p2len;
18
19@@ -369,15 +369,7 @@ getpwent_next_nss_netgr (const char *nam
20 if (!nss_getpwnam_r)
21 return NSS_STATUS_UNAVAIL;
22
23- if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
24- {
25- ent->netgroup = false;
26- ent->first = false;
27- give_pwd_free (&ent->pwd);
28- return NSS_STATUS_UNAVAIL;
29- }
30-
31- if (ent->first == true)
32+ if (ent->first)
33 {
34 memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
35 __internal_setnetgrent (group, &ent->netgrdata);
36@@ -403,8 +395,19 @@ getpwent_next_nss_netgr (const char *nam
37 if (user == NULL || user[0] == '-')
38 continue;
39
40- if (domain != NULL && strcmp (curdomain, domain) != 0)
41- continue;
42+ if (domain != NULL)
43+ {
44+ if (curdomain == NULL
45+ && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
46+ {
47+ __internal_endnetgrent (&ent->netgrdata);
48+ ent->netgroup = false;
49+ give_pwd_free (&ent->pwd);
50+ return NSS_STATUS_UNAVAIL;
51+ }
52+ if (strcmp (curdomain, domain) != 0)
53+ continue;
54+ }
55
56 /* If name != NULL, we are called from getpwnam. */
57 if (name != NULL)
58Index: glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-spwd.c
59===================================================================
60--- glibc-2.12-2-gc4ccff1.orig/nis/nss_compat/compat-spwd.c
61+++ glibc-2.12-2-gc4ccff1/nis/nss_compat/compat-spwd.c
62@@ -317,7 +317,7 @@ getspent_next_nss_netgr (const char *nam
63 char *group, char *buffer, size_t buflen,
64 int *errnop)
65 {
66- char *curdomain, *host, *user, *domain, *p2;
67+ char *curdomain = NULL, *host, *user, *domain, *p2;
68 size_t p2len;
69
70 if (!nss_getspnam_r)
71@@ -327,15 +327,7 @@ getspent_next_nss_netgr (const char *nam
72 if (ent->setent_status != NSS_STATUS_SUCCESS)
73 return ent->setent_status;
74
75- if (yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
76- {
77- ent->netgroup = false;
78- ent->first = false;
79- give_spwd_free (&ent->pwd);
80- return NSS_STATUS_UNAVAIL;
81- }
82-
83- if (ent->first == true)
84+ if (ent->first)
85 {
86 memset (&ent->netgrdata, 0, sizeof (struct __netgrent));
87 __internal_setnetgrent (group, &ent->netgrdata);
88@@ -362,8 +354,19 @@ getspent_next_nss_netgr (const char *nam
89 if (user == NULL || user[0] == '-')
90 continue;
91
92- if (domain != NULL && strcmp (curdomain, domain) != 0)
93- continue;
94+ if (domain != NULL)
95+ {
96+ if (curdomain == NULL
97+ && yp_get_default_domain (&curdomain) != YPERR_SUCCESS)
98+ {
99+ __internal_endnetgrent (&ent->netgrdata);
100+ ent->netgroup = false;
101+ give_spwd_free (&ent->pwd);
102+ return NSS_STATUS_UNAVAIL;
103+ }
104+ if (strcmp (curdomain, domain) != 0)
105+ continue;
106+ }
107
108 /* If name != NULL, we are called from getpwnam */
109 if (name != NULL)