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
This commit is contained in:
parent
a3ee32f3f7
commit
a9f7d76b96
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99768
@ -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 <util.h>
|
||||
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user