From 71869d2ebda5e6489892752d4cae3d53eea07e58 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 11 Jul 2002 10:36:10 +0000 Subject: Use realhostname_sa(3) so the IP address will be used instead of the hostname if the latter is too long for utmp. Submitted by: ru MFC after: 3 days --- crypto/openssh/loginrec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'crypto') diff --git a/crypto/openssh/loginrec.c b/crypto/openssh/loginrec.c index 609e847..dfdf08a 100644 --- a/crypto/openssh/loginrec.c +++ b/crypto/openssh/loginrec.c @@ -164,6 +164,7 @@ #include "atomicio.h" RCSID("$Id: loginrec.c,v 1.40 2002/04/23 13:09:19 djm Exp $"); +RCSID("$FreeBSD$"); #ifdef HAVE_UTIL_H # include @@ -654,7 +655,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 */ -- cgit v1.1