matrix-gui-e: bump PR for init file fixes
[openembedded.git] / recipes / glibc / glibc-2.3.2 / nss_compat-shadow.patch
blob1fc774aadbe36ccc753c77152235adf59a681712
1 --- nis/nss_compat/compat-spwd.c
2 +++ nis/nss_compat/compat-spwd.c 2003/09/01 15:14:14
3 @@ -435,7 +435,7 @@
4 copy_spwd_changes (result, &pwd, p, plen);
5 give_spwd_free (&pwd);
6 /* We found the entry. */
7 - return NSS_STATUS_RETURN;
8 + return NSS_STATUS_SUCCESS;
11 static enum nss_status
12 @@ -539,13 +539,16 @@
13 if (result->sp_namp[0] == '+' && result->sp_namp[1] != '\0'
14 && result->sp_namp[1] != '@')
16 + size_t len = strlen (result->sp_namp);
17 + char buf[len];
18 enum nss_status status;
20 /* Store the User in the blacklist for the "+" at the end of
21 /etc/passwd */
22 - blacklist_store_name (&result->sp_namp[1], ent);
23 + memcpy (buf, &result->sp_namp[1], len);
24 status = getspnam_plususer (&result->sp_namp[1], result, ent,
25 buffer, buflen, errnop);
26 + blacklist_store_name (buf, ent);
28 if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
29 break;
30 @@ -653,6 +656,9 @@
31 return NSS_STATUS_TRYAGAIN;
34 + /* Terminate the line for any case. */
35 + buffer[buflen - 1] = '\0';
37 /* Skip leading blanks. */
38 while (isspace (*p))
39 ++p;
40 @@ -686,21 +692,8 @@
41 if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@'
42 && result->sp_namp[2] != '\0')
44 - /* XXX Do not use fixed length buffers. */
45 - char buf2[1024];
46 - char *user, *host, *domain;
47 - struct __netgrent netgrdata;
49 - bzero (&netgrdata, sizeof (struct __netgrent));
50 - __internal_setnetgrent (&result->sp_namp[2], &netgrdata);
51 - while (__internal_getnetgrent_r (&host, &user, &domain, &netgrdata,
52 - buf2, sizeof (buf2), errnop))
53 - {
54 - if (user != NULL && user[0] != '-')
55 - if (strcmp (user, name) == 0)
56 - return NSS_STATUS_NOTFOUND;
57 - }
58 - __internal_endnetgrent (&netgrdata);
59 + if (innetgr (&result->sp_namp[2], NULL, name, NULL))
60 + return NSS_STATUS_NOTFOUND;
61 continue;
64 @@ -708,25 +701,18 @@
65 if (result->sp_namp[0] == '+' && result->sp_namp[1] == '@'
66 && result->sp_namp[2] != '\0')
68 - char *buf = strdupa (&result->sp_namp[2]);
69 - int status;
70 + enum nss_status status;
72 - ent->netgroup = TRUE;
73 - ent->first = TRUE;
74 - copy_spwd_changes (&ent->pwd, result, NULL, 0);
75 + if (innetgr (&result->sp_namp[2], NULL, name, NULL))
76 + {
77 + status = getspnam_plususer (name, result, ent, buffer,
78 + buflen, errnop);
80 - do
81 - {
82 - status = getspent_next_nss_netgr (name, result, ent, buf,
83 - buffer, buflen, errnop);
84 - if (status == NSS_STATUS_RETURN)
85 - continue;
86 + if (status == NSS_STATUS_RETURN)
87 + continue;
89 - if (status == NSS_STATUS_SUCCESS
90 - && strcmp (result->sp_namp, name) == 0)
91 - return NSS_STATUS_SUCCESS;
92 - }
93 - while (status == NSS_STATUS_SUCCESS);
94 + return status;
95 + }
96 continue;
99 @@ -767,10 +753,12 @@
100 status = getspnam_plususer (name, result, ent,
101 buffer, buflen, errnop);
103 - if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
104 - return NSS_STATUS_NOTFOUND;
105 - else
106 - return status;
107 + if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
108 + break;
109 + else if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
110 + return NSS_STATUS_NOTFOUND;
111 + else
112 + return status;
115 return NSS_STATUS_SUCCESS;
116 @@ -796,10 +784,8 @@
118 result = internal_setspent (&ent, 0);
120 - if (result != NSS_STATUS_SUCCESS)
121 - return result;
123 - result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
124 + if (result == NSS_STATUS_SUCCESS)
125 + result = internal_getspnam_r (name, pwd, &ent, buffer, buflen, errnop);
127 internal_endspent (&ent);