Subject: Re: UT_HOSTSIZE
To: Kimmo Suominen <kim@tac.nyc.ny.us>
From: Christos Zoulas <christos@deshaw.com>
List: current-users
Date: 05/27/1996 21:05:51
On May 27,  2:53pm, kim@tac.nyc.ny.us (Kimmo Suominen) wrote:
-- Subject: UT_HOSTSIZE

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

For compatibility with the 4.4 BSD utmp format.
| 
| What would the problems be in increasing the size?  I understand
| that everything using utmp type files needs to be recompiled.

That is the only problem.
| 
| 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?).

It should be probably MAXHOSTNAMELEN, since the other strings are
not NULL terminated. There is descussion in current-users about this,
but it will not make it for 1.2. The way things look is that in the
next version there will be a field to store the IP address. The question
is: should we make the field large enough now to hold IPV6 addresses,
or not bother right now? What about other non IP addresses?

christos