Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen change dns_getpw() to skip dodgy entries when d...



details:   https://anonhg.NetBSD.org/src/rev/686e5a0429cf
branches:  trunk
changeset: 472246:686e5a0429cf
user:      lukem <lukem%NetBSD.org@localhost>
date:      Mon Apr 26 04:01:32 1999 +0000

description:
change dns_getpw() to skip dodgy entries when doing getpwent(), rather
than returning NS_UNAVAIL. this means that a -ve uid entry in hesiod
doesn't stop getpwent() in its tracks. it also brings it in line with
how nis_getpw() works as well in this situation.
problem tracked down (with much pain & suffereing) by simonb.

XXX: we currently have no support for -ve uids, and this is painful in
XXX: hetrogenous environment... (this -ve check is enforced in __pwscan())

diffstat:

 lib/libc/gen/getpwent.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r 2bfc0fbd1322 -r 686e5a0429cf lib/libc/gen/getpwent.c
--- a/lib/libc/gen/getpwent.c   Mon Apr 26 03:30:48 1999 +0000
+++ b/lib/libc/gen/getpwent.c   Mon Apr 26 04:01:32 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getpwent.c,v 1.42 1999/04/25 07:54:01 lukem Exp $      */
+/*     $NetBSD: getpwent.c,v 1.43 1999/04/26 04:01:32 lukem Exp $      */
 
 /*
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: getpwent.c,v 1.42 1999/04/25 07:54:01 lukem Exp $");
+__RCSID("$NetBSD: getpwent.c,v 1.43 1999/04/26 04:01:32 lukem Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -463,6 +463,7 @@
        int               r;
 
        search = va_arg(ap, int);
+ nextdnsbynum:
        switch (search) {
        case _PW_KEYBYNUM:
                if (_pw_hesnum == -1)
@@ -504,9 +505,11 @@
        strncpy(line, hp[0], sizeof(line));     /* only check first elem */
        line[sizeof(line) - 1] = '\0';
        hesiod_free_list(context, hp);
-       if (__pwparse(&_pw_passwd, line))
+       if (__pwparse(&_pw_passwd, line)) {
+               if (search == _PW_KEYBYNUM)
+                       goto nextdnsbynum;      /* skip dogdy entries */
                r = NS_UNAVAIL;
-       else
+       } else
                r = NS_SUCCESS;
  cleanup_dns_getpw:
        hesiod_end(context);



Home | Main Index | Thread Index | Old Index