From: Ulrich Drepper Date: Tue, 9 Dec 1997 23:43:33 +0000 (+0000) Subject: If buffer is to small, set the file handle for /etc/group back in some X-Git-Tag: cvs/glibc-2_0_6pre3~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=50093870ac3521e97557dd1e8c3f0b247f86859c;p=thirdparty%2Fglibc.git If buffer is to small, set the file handle for /etc/group back in some more cases. --- diff --git a/nis/nss_compat/compat-grp.c b/nis/nss_compat/compat-grp.c index 58a5a7f525c..12988eb3566 100644 --- a/nis/nss_compat/compat-grp.c +++ b/nis/nss_compat/compat-grp.c @@ -312,6 +312,7 @@ getgrent_next_file (struct group *result, ent_t *ent, return NSS_STATUS_NOTFOUND; else { + fsetpos (ent->stream, &pos); __set_errno (ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -366,9 +367,14 @@ getgrent_next_file (struct group *result, ent_t *ent, if (status == NSS_STATUS_RETURN) /* We couldn't parse the entry */ continue; else - return status; + { + if (status == NSS_STATUS_TRYAGAIN) + /* The parser ran out of space. */ + fsetpos (ent->stream, &pos); + return status; + } } - + /* +:... */ if (result->gr_name[0] == '+' && result->gr_name[1] == '\0') { @@ -436,6 +442,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent, return NSS_STATUS_NOTFOUND; else { + fsetpos (ent->stream, &pos); __set_errno (ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -471,8 +478,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent, } /* -group */ - if (result->gr_name[0] == '-' && result->gr_name[1] != '\0' - && result->gr_name[1] != '@') + if (result->gr_name[0] == '-' && result->gr_name[1] != '\0') { if (strcmp (&result->gr_name[1], name) == 0) return NSS_STATUS_NOTFOUND; @@ -481,8 +487,7 @@ internal_getgrnam_r (const char *name, struct group *result, ent_t *ent, } /* +group */ - if (result->gr_name[0] == '+' && result->gr_name[1] != '\0' - && result->gr_name[1] != '@') + if (result->gr_name[0] == '+' && result->gr_name[1] != '\0') { if (strcmp (name, &result->gr_name[1]) == 0) { @@ -598,6 +603,7 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent, return NSS_STATUS_NOTFOUND; else { + fsetpos (ent->stream, &pos); __set_errno (ERANGE); return NSS_STATUS_TRYAGAIN; } @@ -633,16 +639,14 @@ internal_getgrgid_r (gid_t gid, struct group *result, ent_t *ent, } /* -group */ - if (result->gr_name[0] == '-' && result->gr_name[1] != '\0' - && result->gr_name[1] != '@') + if (result->gr_name[0] == '-' && result->gr_name[1] != '\0') { blacklist_store_name (&result->gr_name[1], ent); continue; } /* +group */ - if (result->gr_name[0] == '+' && result->gr_name[1] != '\0' - && result->gr_name[1] != '@') + if (result->gr_name[0] == '+' && result->gr_name[1] != '\0') { enum nss_status status;