diff options
| author | christos <christos@NetBSD.org> | 2005-04-19 03:22:54 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2005-04-19 03:22:54 +0000 |
| commit | cce62d09524e16c7b7eeed063ff8df5141980145 (patch) | |
| tree | 7b4519ce1910f157bc3d3192cbc26c9e6f7f87da /libexec | |
| parent | eea147d9f9a46de628a5a441ad82fd629945dc0b (diff) | |
check pwd != NULL
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/rexecd/rexecd.c | 7 | ||||
| -rw-r--r-- | libexec/rshd/rshd.c | 7 |
2 files changed, 8 insertions, 6 deletions
diff --git a/libexec/rexecd/rexecd.c b/libexec/rexecd/rexecd.c index 36924ad2ed2..b668e9b9add 100644 --- a/libexec/rexecd/rexecd.c +++ b/libexec/rexecd/rexecd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rexecd.c,v 1.22 2005/03/30 01:07:47 christos Exp $ */ +/* $NetBSD: rexecd.c,v 1.23 2005/04/19 03:22:54 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -36,7 +36,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "from: @(#)rexecd.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: rexecd.c,v 1.22 2005/03/30 01:07:47 christos Exp $"); +__RCSID("$NetBSD: rexecd.c,v 1.23 2005/04/19 03:22:54 christos Exp $"); #endif #endif /* not lint */ @@ -219,7 +219,8 @@ doit(struct sockaddr *fromp) getstr(pass, sizeof(pass), "password"); getstr(cmdbuf, sizeof(cmdbuf), "command"); (void)alarm(0); - if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0) { + if (getpwnam_r(user, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 || + pwd == NULL) { if (dolog) syslog(LOG_ERR, "no such user %s", user); rexecd_errx(EXIT_FAILURE, "Login incorrect."); diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c index bffcab1fc2c..366c207915a 100644 --- a/libexec/rshd/rshd.c +++ b/libexec/rshd/rshd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rshd.c,v 1.42 2005/03/30 01:33:30 christos Exp $ */ +/* $NetBSD: rshd.c,v 1.43 2005/04/19 03:24:24 christos Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -69,7 +69,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1992, 1993, 1994\n\ #if 0 static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; #else -__RCSID("$NetBSD: rshd.c,v 1.42 2005/03/30 01:33:30 christos Exp $"); +__RCSID("$NetBSD: rshd.c,v 1.43 2005/04/19 03:24:24 christos Exp $"); #endif #endif /* not lint */ @@ -483,7 +483,8 @@ doit(struct sockaddr *fromp) } #endif /* USE_PAM */ setpwent(); - if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0) { + if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 || + pwd == NULL) { syslog(LOG_INFO|LOG_AUTH, "%s@%s as %s: unknown login. cmd='%.80s'", remuser, hostname, locuser, cmdbuf); |
