1 --- nis/nss_compat/compat-spwd.c
2 +++ nis/nss_compat/compat-spwd.c 2003/09/01 15:14:14
4 copy_spwd_changes (result, &pwd, p, plen);
6 /* We found the entry. */
7 - return NSS_STATUS_RETURN;
8 + return NSS_STATUS_SUCCESS;
11 static enum nss_status
13 if (result->sp_namp[0] == '+' && result->sp_namp[1] != '\0'
14 && result->sp_namp[1] != '@')
16 + size_t len = strlen (result->sp_namp);
18 enum nss_status status;
20 /* Store the User in the blacklist for the "+" at the end of
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. */
31 return NSS_STATUS_TRYAGAIN;
34 + /* Terminate the line for any case. */
35 + buffer[buflen - 1] = '\0';
37 /* Skip leading blanks. */
41 if (result->sp_namp[0] == '-' && result->sp_namp[1] == '@'
42 && result->sp_namp[2] != '\0')
44 - /* XXX Do not use fixed length buffers. */
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))
54 - if (user != NULL && user[0] != '-')
55 - if (strcmp (user, name) == 0)
56 - return NSS_STATUS_NOTFOUND;
58 - __internal_endnetgrent (&netgrdata);
59 + if (innetgr (&result->sp_namp[2], NULL, name, NULL))
60 + return NSS_STATUS_NOTFOUND;
65 if (result->sp_namp[0] == '+' && result->sp_namp[1] == '@'
66 && result->sp_namp[2] != '\0')
68 - char *buf = strdupa (&result->sp_namp[2]);
70 + enum nss_status status;
72 - ent->netgroup = TRUE;
74 - copy_spwd_changes (&ent->pwd, result, NULL, 0);
75 + if (innetgr (&result->sp_namp[2], NULL, name, NULL))
77 + status = getspnam_plususer (name, result, ent, buffer,
82 - status = getspent_next_nss_netgr (name, result, ent, buf,
83 - buffer, buflen, errnop);
84 - if (status == NSS_STATUS_RETURN)
86 + if (status == NSS_STATUS_RETURN)
89 - if (status == NSS_STATUS_SUCCESS
90 - && strcmp (result->sp_namp, name) == 0)
91 - return NSS_STATUS_SUCCESS;
93 - while (status == NSS_STATUS_SUCCESS);
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;
107 + if (status == NSS_STATUS_SUCCESS) /* We found the entry. */
109 + else if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */
110 + return NSS_STATUS_NOTFOUND;
115 return NSS_STATUS_SUCCESS;
118 result = internal_setspent (&ent, 0);
120 - if (result != NSS_STATUS_SUCCESS)
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);