sshd doesn't log hostname into utmp correctly [resend]

Kevin Steves kevin at atomicgears.com
Tue Aug 20 23:49:22 EST 2002


On Tue, Aug 20, 2002 at 02:49:43PM +0900, Hajimu UMEMOTO wrote:
> >>>>> On Mon, 19 Aug 2002 14:19:02 -0700
> >>>>> Kevin Steves <kevin at atomicgears.com> said:
> 
> kevin> thanks.  which utmp field is effected?  in loginrec.c i see ut_addr
> kevin> being set from sockaddr, but for AF_INET only.  and ut_host is set
> kevin> from the login_alloc_entry() hostname argument it seems.
> 
> record_login() copies addr by calling login_set_addr() but just
> sizeof(struct sockaddr).  Since sizeof(struct sockaddr) is equal to
> sizeof(struct sockaddr_in), IPv4 is not affected.  However,
> sizeof(struct sockaddr) is too short against sizeof(struct
> sockaddr_in6).  This breaks IPv6 address.

i understand the issue, but i don't see how current utmp recording
results are changed.  i am looking at this code.

# ifdef HAVE_HOST_IN_UTMP
	strncpy(ut->ut_host, li->hostname, MIN_SIZEOF(ut->ut_host, li->hostname));
# endif
# ifdef HAVE_ADDR_IN_UTMP
	/* this is just a 32-bit IP address */
	if (li->hostaddr.sa.sa_family == AF_INET)
		ut->ut_addr = li->hostaddr.sa_in.sin_addr.s_addr;
# endif



More information about the openssh-unix-dev mailing list