Subject: Re: "who" question
To: Jeremy C. Reed <reed@reedmedia.net>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 05/30/2001 07:01:12
In message <Pine.LNX.4.21.0105292225390.12431-100000@pilchuck.reedmedia.net>, "
Jeremy C. Reed" writes:
>On Mon, 28 May 2001 emre@vsrc.uab.edu wrote:
>
>> When I type "who" I can see all users logged on and the hosst they are
>> logged from. But somehow I can only see part of the hostname (if it's
>> too long).  Is there a way to make it show the full hostname?
>
>/usr/src/usr.bin/who/who.c uses:
>
>                printf("\t(%.*s)", (int)UT_HOSTSIZE, up->ut_host);
>
>UT_HOSTSIZE is 16.
>
>It would be interesting to add an option for no cropped strings; here is
>something to try (use the -N switch):

Without having tried your fix, it's extremely improbable that it would 
work -- the problem is that the utmp structure has 16-byte host names, 
and that's all that's recorded at login time.  Your fix, in fact, is 
likely to cause lots of garbage output, since truncated host entries 
aren't null-terminated.

If you want to change it, you'd have to change /usr/include/utmp.h and 
then recompile everything that uses it; this includes things like 
xterm, I believe. 


		--Steve Bellovin, http://www.research.att.com/~smb