From owner-svn-src-all@FreeBSD.ORG Tue Oct 21 11:58:27 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 377E510656B0; Tue, 21 Oct 2008 11:58:27 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 277828FC32; Tue, 21 Oct 2008 11:58:27 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9LBwRAe098422; Tue, 21 Oct 2008 11:58:27 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9LBwRFq098420; Tue, 21 Oct 2008 11:58:27 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200810211158.m9LBwRFq098420@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Tue, 21 Oct 2008 11:58:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r184122 - head/crypto/openssh X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2008 11:58:27 -0000 Author: des Date: Tue Oct 21 11:58:26 2008 New Revision: 184122 URL: http://svn.freebsd.org/changeset/base/184122 Log: 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 MFC after: 1 week Modified: head/crypto/openssh/loginrec.c head/crypto/openssh/sshd.c Modified: head/crypto/openssh/loginrec.c ============================================================================== --- head/crypto/openssh/loginrec.c Tue Oct 21 10:54:12 2008 (r184121) +++ head/crypto/openssh/loginrec.c Tue Oct 21 11:58:26 2008 (r184122) @@ -146,7 +146,6 @@ */ #include "includes.h" -__RCSID("$FreeBSD$"); #include #include @@ -689,8 +688,8 @@ construct_utmp(struct logininfo *li, 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 */ Modified: head/crypto/openssh/sshd.c ============================================================================== --- head/crypto/openssh/sshd.c Tue Oct 21 10:54:12 2008 (r184121) +++ head/crypto/openssh/sshd.c Tue Oct 21 11:58:26 2008 (r184122) @@ -72,6 +72,7 @@ __RCSID("$FreeBSD$"); #include #include #include +#include #include #include @@ -238,7 +239,7 @@ u_char *session_id2 = NULL; 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;