diff options
Diffstat (limited to 'nis/nss_compat/compat-spwd.c')
-rw-r--r-- | nis/nss_compat/compat-spwd.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/nis/nss_compat/compat-spwd.c b/nis/nss_compat/compat-spwd.c index 83db85620e..816e9c1f0a 100644 --- a/nis/nss_compat/compat-spwd.c +++ b/nis/nss_compat/compat-spwd.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1996. @@ -761,12 +761,16 @@ getspent_next_file (struct spwd *result, ent_t *ent, do { fgetpos (ent->stream, &pos); + buffer[buflen - 1] = '\xff'; p = fgets (buffer, buflen, ent->stream); - if (p == NULL) + if (p == NULL && feof (ent->stream)) return NSS_STATUS_NOTFOUND; - - /* Terminate the line for any case. */ - buffer[buflen - 1] = '\0'; + if (p == NULL || buffer[buflen - 1] != '\xff') + { + fsetpos (ent->stream, &pos); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } /* Skip leading blanks. */ while (isspace (*p)) @@ -965,12 +969,16 @@ internal_getspnam_r (const char *name, struct spwd *result, ent_t *ent, do { fgetpos (ent->stream, &pos); + buffer[buflen - 1] = '\xff'; p = fgets (buffer, buflen, ent->stream); - if (p == NULL) + if (p == NULL && feof (ent->stream)) return NSS_STATUS_NOTFOUND; - - /* Terminate the line for any case. */ - buffer[buflen - 1] = '\0'; + if (p == NULL || buffer[buflen - 1] != '\xff') + { + fsetpos (ent->stream, &pos); + *errnop = ERANGE; + return NSS_STATUS_TRYAGAIN; + } /* Skip leading blanks. */ while (isspace (*p)) |