diff options
Diffstat (limited to 'nis/nss_compat/compat-grp.c')
-rw-r--r-- | nis/nss_compat/compat-grp.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c index a586d1fbbf..4b873d6915 100644 --- a/nis/nss_compat/compat-grp.c +++ b/nis/nss_compat/compat-grp.c @@ -125,9 +125,14 @@ internal_setgrent (ent_t *ent) ent->result = NULL; } - ent->blacklist.current = 0; if (ent->blacklist.data != NULL) - ent->blacklist.data[0] = '\0'; + { + ent->blacklist.current = 1; + ent->blacklist.data[0] = '|'; + ent->blacklist.data[1] = '\0'; + } + else + ent->blacklist.current = 0; if (ent->stream == NULL) { @@ -202,9 +207,14 @@ internal_endgrent (ent_t *ent) ent->result = NULL; } - ent->blacklist.current = 0; if (ent->blacklist.data != NULL) - ent->blacklist.data[0] = '\0'; + { + ent->blacklist.current = 1; + ent->blacklist.data[0] = '|'; + ent->blacklist.data[1] = '\0'; + } + else + ent->blacklist.current = 0; return NSS_STATUS_SUCCESS; } @@ -411,22 +421,17 @@ getgrnam_plusgroup (const char *name, struct group *result, char *buffer, int outvallen; if (yp_get_default_domain (&domain) != YPERR_SUCCESS) - { - *errnop = errno; - return NSS_STATUS_TRYAGAIN; - } + return NSS_STATUS_NOTFOUND; if (yp_match (domain, "group.byname", name, strlen (name), &outval, &outvallen) != YPERR_SUCCESS) - { - *errnop = errno; - return NSS_STATUS_TRYAGAIN; - } + return NSS_STATUS_NOTFOUND; + p = strncpy (buffer, outval, buflen < (size_t) outvallen ? buflen : (size_t) outvallen); free (outval); while (isspace (*p)) - p++; + ++p; parse_res = _nss_files_parse_grent (p, result, data, buflen, errnop); if (parse_res == -1) return NSS_STATUS_TRYAGAIN; @@ -513,7 +518,8 @@ getgrent_next_file (struct group *result, ent_t *ent, if (status == NSS_STATUS_SUCCESS) /* We found the entry. */ break; else - if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */ + if (status == NSS_STATUS_RETURN /* We couldn't parse the entry */ + || status == NSS_STATUS_NOTFOUND) /* No group in NIS */ continue; else { |