Source-Changes-HG archive

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

[src/netbsd-3]: src/lib/libc/net Pull up revision 1.60 (requested by lukem in...



details:   https://anonhg.NetBSD.org/src/rev/6a59cf3142b6
branches:  netbsd-3
changeset: 576520:6a59cf3142b6
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jul 09 22:51:22 2005 +0000

description:
Pull up revision 1.60 (requested by lukem in ticket #534):
check for pwd != NULL

diffstat:

 lib/libc/net/rcmd.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 18fe6badcf60 -r 6a59cf3142b6 lib/libc/net/rcmd.c
--- a/lib/libc/net/rcmd.c       Sat Jul 09 22:50:21 2005 +0000
+++ b/lib/libc/net/rcmd.c       Sat Jul 09 22:51:22 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcmd.c,v 1.58.2.1 2005/04/04 17:58:21 tron Exp $       */
+/*     $NetBSD: rcmd.c,v 1.58.2.2 2005/07/09 22:51:22 tron Exp $       */
 
 /*
  * Copyright (c) 1983, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rcmd.c     8.3 (Berkeley) 3/26/94";
 #else
-__RCSID("$NetBSD: rcmd.c,v 1.58.2.1 2005/04/04 17:58:21 tron Exp $");
+__RCSID("$NetBSD: rcmd.c,v 1.58.2.2 2005/07/09 22:51:22 tron Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -403,7 +403,8 @@
                rshcmd = _PATH_BIN_RCMD;
 
        /* locuser must exist on this host. */
-       if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pw) != 0) {
+       if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pw) != 0 ||
+           pw == NULL) {
                warnx("rshrcmd: unknown user: %s", locuser);
                return(-1);
        }
@@ -683,7 +684,8 @@
        isvaliduser = -1;
        if (__check_rhosts_file || superuser) {
 
-               if (getpwnam_r(luser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0)
+               if (getpwnam_r(luser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0
+                   || pwd == NULL)
                        return (-1);
                (void)strlcpy(pbuf, pwd->pw_dir, sizeof(pbuf));
                (void)strlcat(pbuf, "/.rhosts", sizeof(pbuf));



Home | Main Index | Thread Index | Old Index