Subject: UT_HOSTSIZE
To: None <current-users@NetBSD.ORG>
From: Kimmo Suominen <kim@tac.nyc.ny.us>
List: current-users
Date: 05/27/1996 14:53:59
[NetBSD/i386 beowulf.gw.com 1.1B]

On NetBSD UT_HOSTSIZE is only 16 (characters).  This means most
hostnames will *not* be stored in utmp but instead only the IP
address.  [This further means that REMOTEHOST in tcsh is set to
an IP address... *sigh*]

Would anyone happen to know why UT_HOSTSIZE is so small?

What would the problems be in increasing the size?  I understand
that everything using utmp type files needs to be recompiled.

Our domain "nyc.deshaw.com" is already 14 characters, so only one
letter host names would get stored here...

By the way, /usr/bin/login has a minor workaround to this: it
only stores the short name in utmp if the domain of the remote
end matches that of the host itself.  Of course, I would really
rather see a longer UT_HOSTSIZE, but I also think telnetd and
login should be behaving the same way.

Reading telnetd.c and sys_term.c is not easy, so I don't quite
follow what it is doing.  It seems to me that at least sometimes
telnetd passes the hostname with "-h" to login.  If it was just
doing this always instead of creating the utmp/wtmp entry, it'd
behave like rlogin and login.

In sys_term.c strncpy is used to copy the hostname into the utmp
structure, so I guess the earlier length check is only to avoid
truncated hostnames (using IP addresses instead).

So, I'd still vote for increasing UT_HOSTSIZE to MAXHOSTNAMELEN
(or should it be MAXHOSTNAMELEN + 1?).

+ Kim