Source-Changes-HG archive

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

[src/trunk]: src/crypto/dist/ssh utmpx.ut_id is required.



details:   https://anonhg.NetBSD.org/src/rev/bccd1b43e9ab
branches:  trunk
changeset: 535481:bccd1b43e9ab
user:      itojun <itojun%NetBSD.org@localhost>
date:      Tue Aug 20 07:42:53 2002 +0000

description:
utmpx.ut_id is required.
PR 17998 with slight modification (deal with ttyname shorter than 4)

diffstat:

 crypto/dist/ssh/sshlogin.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 79cb846201f0 -r bccd1b43e9ab crypto/dist/ssh/sshlogin.c
--- a/crypto/dist/ssh/sshlogin.c        Tue Aug 20 06:20:26 2002 +0000
+++ b/crypto/dist/ssh/sshlogin.c        Tue Aug 20 07:42:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sshlogin.c,v 1.5 2002/07/28 23:43:33 christos Exp $    */
+/*     $NetBSD: sshlogin.c,v 1.6 2002/08/20 07:42:53 itojun Exp $      */
 /*
  * Author: Tatu Ylonen <ylo%cs.hut.fi@localhost>
  * Copyright (c) 1995 Tatu Ylonen <ylo%cs.hut.fi@localhost>, Espoo, Finland
@@ -165,6 +165,13 @@
                ux.ut_tv = tv;
                strncpy(ux.ut_name, user, sizeof(ux.ut_name));
                strncpy(ux.ut_host, host, sizeof(ux.ut_host));
+               /* XXX: need ut_id, use last 4 char of ttyname */
+               if (strlen(ttyname) > sizeof(ux.ut_id)) {
+                       strncpy(ux.ut_id,
+                           ttyname + strlen(ttyname) - sizeof(ux.ut_id),
+                           sizeof(ux.ut_id));
+               } else
+                       strncpy(ux.ut_id, ttyname, sizeof(ux.ut_id));
                /* XXX: It would be better if we had sockaddr_storage here */
                memcpy(&ux.ut_ss, addr, sizeof(*addr));
                if (pututxline(&ux) == NULL)



Home | Main Index | Thread Index | Old Index