r184122 | des | 2008-10-21 06:58:26 -0500 (Tue, 21 Oct 2008) | 11 lines
Changed paths:
   M /head/crypto/openssh/loginrec.c
   M /head/crypto/openssh/sshd.c

At some point, construct_utmp() was changed to use realhostname() to fill
in the struct utmp due to concerns about the length of the hostname buffer.
However, this breaks the UseDNS option.  There is a simpler and better
solution: initialize utmp_len to the correct value (UT_HOSTSIZE instead of
MAXHOSTNAMELEN) and let get_remote_name_or_ip() worry about the size of the
buffer.

PR:             bin/97499
Submitted by:   Bruce Cran <bruce@cran.org.uk>

Index: sshd.c
===================================================================
--- sshd.c	(revision 184121)
+++ sshd.c	(revision 184122)
@@ -72,6 +72,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <utmp.h>
 
 #include <openssl/dh.h>
 #include <openssl/bn.h>
@@ -238,7 +239,7 @@
 u_int session_id2_len = 0;
 
 /* record remote hostname or ip */
-u_int utmp_len = MAXHOSTNAMELEN;
+u_int utmp_len = UT_HOSTSIZE;
 
 /* options.max_startup sized array of fd ints */
 int *startup_pipes = NULL;
