Source-Changes-HG archive

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

[src/netbsd-3]: src/libexec/rshd Pull up revision 1.42 (requested by lukem in...



details:   https://anonhg.NetBSD.org/src/rev/024d6098f2e1
branches:  netbsd-3
changeset: 576517:024d6098f2e1
user:      tron <tron%NetBSD.org@localhost>
date:      Sat Jul 09 22:45:30 2005 +0000

description:
Pull up revision 1.42 (requested by lukem in ticket #532):
- use getpwnam_r

diffstat:

 libexec/rshd/rshd.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 288d562d9194 -r 024d6098f2e1 libexec/rshd/rshd.c
--- a/libexec/rshd/rshd.c       Sat Jul 09 22:45:02 2005 +0000
+++ b/libexec/rshd/rshd.c       Sat Jul 09 22:45:30 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rshd.c,v 1.40.2.1 2005/07/09 22:45:02 tron Exp $       */
+/*     $NetBSD: rshd.c,v 1.40.2.2 2005/07/09 22:45:30 tron 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.40.2.1 2005/07/09 22:45:02 tron Exp $");
+__RCSID("$NetBSD: rshd.c,v 1.40.2.2 2005/07/09 22:45:30 tron 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