Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen Restore getpwent() behaviour prior to rev 1.57; ...
details: https://anonhg.NetBSD.org/src/rev/1ae2a0254d81
branches: trunk
changeset: 574414:1ae2a0254d81
user: lukem <lukem%NetBSD.org@localhost>
date: Mon Feb 28 00:40:05 2005 +0000
description:
Restore getpwent() behaviour prior to rev 1.57; skip dodgy NIS & DNS entries
rather than failing with NS_UNAVAIL when encountering them.
Fixes PR 29272 by Antoine Reilles.
diffstat:
lib/libc/gen/getpwent.c | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diffs (66 lines):
diff -r 75433b9a1f6f -r 1ae2a0254d81 lib/libc/gen/getpwent.c
--- a/lib/libc/gen/getpwent.c Sun Feb 27 23:49:05 2005 +0000
+++ b/lib/libc/gen/getpwent.c Mon Feb 28 00:40:05 2005 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: getpwent.c,v 1.65 2004/11/10 12:57:32 lukem Exp $ */
+/* $NetBSD: getpwent.c,v 1.66 2005/02/28 00:40:05 lukem Exp $ */
/*-
- * Copyright (c) 1997-2000, 2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997-2000, 2004-2005 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -95,7 +95,7 @@
#if 0
static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95";
#else
-__RCSID("$NetBSD: getpwent.c,v 1.65 2004/11/10 12:57:32 lukem Exp $");
+__RCSID("$NetBSD: getpwent.c,v 1.66 2005/02/28 00:40:05 lukem Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -833,6 +833,7 @@
return rv;
}
+ next_dns_entry:
hp = NULL;
rv = NS_NOTFOUND;
@@ -854,8 +855,10 @@
if (_pw_parse(hp[0], &_dns_passwd,
_dns_passwdbuf, sizeof(_dns_passwdbuf), 1))
rv = NS_SUCCESS;
- else
- rv = NS_UNAVAIL;
+ else { /* dodgy entry, try again */
+ hesiod_free_list(_dns_state.context, hp);
+ goto next_dns_entry;
+ }
}
if (hp)
@@ -1249,6 +1252,7 @@
return rv;
}
+ next_nis_entry:
key = NULL;
data = NULL;
rv = NS_NOTFOUND;
@@ -1286,8 +1290,12 @@
if (_nis_parse(data, &_nis_passwd,
_nis_passwdbuf, sizeof(_nis_passwdbuf), &_nis_state))
rv = NS_SUCCESS;
- else
- rv = NS_UNAVAIL;
+ else { /* dodgy entry, try again */
+ if (key)
+ free(key);
+ free(data);
+ goto next_nis_entry;
+ }
nisent_out:
if (key)
Home |
Main Index |
Thread Index |
Old Index