64-bit HP/UX 11.00 wtmp corruption identified

Quentin Bracken quentin.bracken at eds.com
Thu Jan 10 06:12:36 EST 2002


I spent some time with 3.0.2p1 to discover why OpenSSH on HP/UX 11.00
64-bit corrupts the /var/adm/wtmp file.  The problem is with the utmp
structure itself.  When building with 32-bit compilation flags, the size
of the utmp structure is 60 bytes.  When building under 64-bit, the size
is 72 bytes.  The size difference is due to structure alignment and
using basic types whose size changes depending on the integer size (like
long).  The OS and tools like "last" expect a wtmp entry to be 60 bytes
in size.  So, when OpenSSH is built with 64-bit options, it writes 72
byte entries into the wtmp causing "last" to seg fault.

I do not know what a good work around could be.  I temporarily modified
the /usr/include/utmp.h structure to use int32_t as the type for ut_time
instead of long and rebuilt loginrec.o and relinked sshd.  OpenSSH
performed correctly, updating wtmp like a champ.  I thought that we
could use utmpname and the pututline tools (which will convert the 72
byte structure to a 60 byte structure somehow), but their behavior is
not actually compatible with wtmp.  I also thought about defining a
custom utmp structure when building on HP-UX 64-bit, but that really
seems like a bad way of doing it.

As far as I can tell, there are no patches from HP regarding this issue.

So, that is why wtmp gets corrupted, but I wish I had a real
work-around.

--
Quentin Bracken
Infrastructure Specialist
EDS


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20020109/5e1d8b8b/attachment.html 


More information about the openssh-unix-dev mailing list