bin/97499: one of sshd_config(5) options does not work

Bruce Cran bruce at cran.org.uk
Mon Mar 31 14:00:07 PDT 2008


The following reply was made to PR bin/97499; it has been noted by GNATS.

From: Bruce Cran <bruce at cran.org.uk>
To: bug-followup at FreeBSD.org, arnoldlee_chn at yahoo.com
Cc:  
Subject: Re: bin/97499: one of sshd_config(5) options does not work
Date: Mon, 31 Mar 2008 21:58:31 +0100

 This is a multi-part message in MIME format.
 --------------020704090400020909060705
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 The attached patches should fix the problem.  There are other places in 
 the code where MAXHOSTNAMELEN is used instead of UT_HOSTSIZE but unless 
 the user overrides utmp_len with the -u command-line switch the existing 
 behaviour will be retained.
 
 
 --------------020704090400020909060705
 Content-Type: text/plain;
  name="loginrec.c.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="loginrec.c.diff"
 
 --- /usr/src/crypto/openssh/loginrec.c	2006-09-30 14:38:04.000000000 +0100
 +++ loginrec.c	2008-03-31 21:45:37.000000000 +0100
 @@ -688,8 +688,8 @@
  	strncpy(ut->ut_name, li->username,
  	    MIN_SIZEOF(ut->ut_name, li->username));
  # ifdef HAVE_HOST_IN_UTMP
 -	realhostname_sa(ut->ut_host, sizeof ut->ut_host,
 -	    &li->hostaddr.sa, li->hostaddr.sa.sa_len);
 +	strncpy(ut->ut_host, li->hostname,
 +	    MIN_SIZEOF(ut->ut_host, li->hostname));
  # endif
  # ifdef HAVE_ADDR_IN_UTMP
  	/* this is just a 32-bit IP address */
 
 --------------020704090400020909060705
 Content-Type: text/plain;
  name="sshd.c.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="sshd.c.diff"
 
 --- /usr/src/crypto/openssh/sshd.c	2006-11-10 16:52:41.000000000 +0000
 +++ sshd.c	2008-03-31 21:45:41.000000000 +0100
 @@ -71,6 +71,7 @@
  #include <stdlib.h>
  #include <string.h>
  #include <unistd.h>
 +#include <utmp.h>
  
  #include <openssl/dh.h>
  #include <openssl/bn.h>
 @@ -235,7 +236,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;
 
 --------------020704090400020909060705--


More information about the freebsd-bugs mailing list