Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/libexec/rshd - use getpwnam_r
details: https://anonhg.NetBSD.org/src/rev/c38d639ae661
branches: trunk
changeset: 579872:c38d639ae661
user: christos <christos%NetBSD.org@localhost>
date: Wed Mar 30 01:33:30 2005 +0000
description:
- use getpwnam_r
diffstat:
libexec/rshd/rshd.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diffs (45 lines):
diff -r eb4c8e332edd -r c38d639ae661 libexec/rshd/rshd.c
--- a/libexec/rshd/rshd.c Wed Mar 30 01:30:21 2005 +0000
+++ b/libexec/rshd/rshd.c Wed Mar 30 01:33:30 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rshd.c,v 1.41 2005/03/27 21:00:58 christos Exp $ */
+/* $NetBSD: rshd.c,v 1.42 2005/03/30 01:33:30 christos Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -69,7 +69,7 @@
#if 0
static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94";
#else
-__RCSID("$NetBSD: rshd.c,v 1.41 2005/03/27 21:00:58 christos Exp $");
+__RCSID("$NetBSD: rshd.c,v 1.42 2005/03/30 01:33:30 christos Exp $");
#endif
#endif /* not lint */
@@ -247,7 +247,7 @@
void
doit(struct sockaddr *fromp)
{
- struct passwd *pwd;
+ struct passwd *pwd, pwres;
in_port_t port;
struct pollfd set[2];
int cc, pv[2], pid, s = -1; /* XXX gcc */
@@ -271,6 +271,7 @@
int gaierror;
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
const char *errormsg = NULL, *errorstr = NULL;
+ char pwbuf[1024];
(void)signal(SIGINT, SIG_DFL);
(void)signal(SIGQUIT, SIG_DFL);
@@ -482,8 +483,7 @@
}
#endif /* USE_PAM */
setpwent();
- pwd = getpwnam(locuser);
- if (pwd == NULL) {
+ if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0) {
syslog(LOG_INFO|LOG_AUTH,
"%s@%s as %s: unknown login. cmd='%.80s'",
remuser, hostname, locuser, cmdbuf);
Home |
Main Index |
Thread Index |
Old Index