From owner-freebsd-stable Thu Jul 11 3:31:13 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 45F5D37B400; Thu, 11 Jul 2002 03:31:07 -0700 (PDT) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 825D743E58; Thu, 11 Jul 2002 03:31:02 -0700 (PDT) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g6BAUjx38001; Thu, 11 Jul 2002 13:30:45 +0300 (EEST) (envelope-from ru) Date: Thu, 11 Jul 2002 13:30:45 +0300 From: Ruslan Ermilov To: David Miller Cc: Dag-Erling Smorgrav , stable@FreeBSD.org Subject: Re: /usr/bin/w -n changes? Message-ID: <20020711103045.GC4745@sunbay.com> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xXmbgvnjoT4axfJE" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.99i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --xXmbgvnjoT4axfJE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 08, 2002 at 12:11:26PM -0400, David Miller wrote: > Hi all; >=20 > Is /usr/bin/w -n not supposed to show IP addresses anymore? >=20 This is because new sshd(8) did not import the relevant fix from previous hacked OpenSSH version. Old version had this in sshlogin.c: : revision 1.3 : date: 2001/05/15 01:50:40; author: green; state: Exp; lines: +2 -2 : branches: 1.3.2; : If a host would exceed 16 characters in the utmp entry, record only : it's IP address/base host instead. :=20 : Submitted by: brian Index: sshlogin.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/crypto/openssh/sshlogin.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -u -r1.2 -r1.3 --- sshlogin.c 4 May 2001 04:14:23 -0000 1.2 +++ sshlogin.c 15 May 2001 01:50:40 -0000 1.3 @@ -99,7 +99,7 @@ record_login(pid_t pid, const char *ttyn strncpy(u.ut_line, ttyname + 5, sizeof(u.ut_line)); u.ut_time =3D time(NULL); strncpy(u.ut_name, user, sizeof(u.ut_name)); - strncpy(u.ut_host, host, sizeof(u.ut_host)); + realhostname_sa(u.ut_host, sizeof(u.ut_host), addr, addr->sa_len); =20 login(&u); lastlog =3D _PATH_LASTLOG; This fix was lost with the latest import (the relevant code is now in loginrec.c). Index: loginrec.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/crypto/openssh/loginrec.c,v retrieving revision 1.1.1.1.2.1 diff -u -p -r1.1.1.1.2.1 loginrec.c --- loginrec.c 3 Jul 2002 22:11:42 -0000 1.1.1.1.2.1 +++ loginrec.c 11 Jul 2002 10:27:54 -0000 @@ -654,7 +654,8 @@ construct_utmp(struct logininfo *li, /* Use strncpy because we don't necessarily want null termination */ strncpy(ut->ut_name, li->username, MIN_SIZEOF(ut->ut_name, li->username)); # ifdef HAVE_HOST_IN_UTMP - strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname)); + realhostname_sa(ut->ut_host, sizeof(ut->ut_host), &li->hostaddr.sa, + li->hostaddr.sa.sa_len); # endif # ifdef HAVE_ADDR_IN_UTMP /* this is just a 32-bit IP address */ Cheers, --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --xXmbgvnjoT4axfJE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQE9LV5VUkv4P6juNwoRAgPjAKCEVnZmE1rHG0IPPhtHSat8DoTcZACeIuwZ yJVUHRB+lM5D0NyEybMErw8= =uVc8 -----END PGP SIGNATURE----- --xXmbgvnjoT4axfJE-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message