Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2002 13:30:45 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        David Miller <stable@d.sparks.net>
Cc:        Dag-Erling Smorgrav <des@FreeBSD.org>, stable@FreeBSD.org
Subject:   Re: /usr/bin/w -n changes?
Message-ID:  <20020711103045.GC4745@sunbay.com>
In-Reply-To: <Pine.BSF.4.21.0207081210060.64744-100000@search.sparks.net>
References:  <Pine.BSF.4.21.0207081210060.64744-100000@search.sparks.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020711103045.GC4745>