From owner-freebsd-bugs Fri Jan 26 12:40:25 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id E254D37B69C for ; Fri, 26 Jan 2001 12:40:01 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f0QKe1E66817; Fri, 26 Jan 2001 12:40:01 -0800 (PST) (envelope-from gnats) Received: from mail.disney.com (mail.disney.com [204.128.192.15]) by hub.freebsd.org (Postfix) with ESMTP id 8FAE437B401 for ; Fri, 26 Jan 2001 12:33:06 -0800 (PST) Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100]) by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id f0QKWdp03083 for ; Fri, 26 Jan 2001 12:32:39 -0800 (PST) Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Fri, 26 Jan 2001 12:33:42 -0800 Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2]) by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id MAA13189 for ; Fri, 26 Jan 2001 12:33:04 -0800 (PST) (envelope-from Jim.Pirzyk@fa.disney.com) Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [153.7.117.170]) by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id MAA28576 for ; Fri, 26 Jan 2001 12:33:03 -0800 (PST) (envelope-from Jim.Pirzyk@fa.disney.com) Received: (from Jim.Pirzyk@localhost) by snoopy.fan.fa.disney.com (8.11.1/8.9.3) id f0QKX3x09073; Fri, 26 Jan 2001 12:33:03 -0800 (PST) (envelope-from Jim.Pirzyk@fa.disney.com) Message-Id: <200101262033.f0QKX3x09073@snoopy.fan.fa.disney.com> Date: Fri, 26 Jan 2001 12:33:03 -0800 (PST) From: Jim.Pirzyk@disney.com Reply-To: Jim.Pirzyk@disney.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/24659: realhostname_sa does not call trimdomain before IP number is stored Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 24659 >Category: bin >Synopsis: realhostname_sa does not call trimdomain for IPv4 addresses >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 26 12:40:01 PST 2001 >Closed-Date: >Last-Modified: >Originator: Jim Pirzyk >Release: FreeBSD 4.2-RELEASE i386 >Organization: >Environment: Using ssh to login to remote FreeBSD boxes and hostnames > 16 characters in the local domain. >Description: in the realhostname_sa routine (libutil), if the hostname of the remote system is > 16 characters long, the IP number is stored in the wtmp file. This happens even for hosts that are in the same DNS Domain. Conversely, in the login program, which does not call realhostname_sa, it trims the hostname before writing the hostname into the file. realhostname_sa is called by sshd. >How-To-Repeat: Login to a remote FreeBSD host from a host that has a long hostname. First login with rsh, then do a finger -sh, it should show a short hostname for 'Where'. Then login via ssh, do the finger -sh and it will show the IP number instead. >Fix: *** realhostname.c.orig Tue Jul 18 03:25:37 2000 --- realhostname.c Fri Jan 26 12:23:46 2001 *************** *** 131,150 **** freeaddrinfo(ores); goto numeric; } ! if (strlen(ores->ai_canonname) > hsize) { if (addr->sa_family == AF_INET) { freeaddrinfo(ores); goto numeric; } ! strncpy(buf, ! ores->ai_canonname, ! sizeof(buf)); ! trimdomain(buf, hsize); ! strncpy(host, buf, hsize); ! } else ! strncpy(host, ! ores->ai_canonname, ! hsize); break; } ((struct sockinet *)addr)->si_port = port; --- 134,150 ---- freeaddrinfo(ores); goto numeric; } ! strncpy(buf, ! ores->ai_canonname, ! sizeof(buf)); ! trimdomain(buf, hsize); ! strncpy(host, buf, hsize); ! if (strlen(host) > hsize) { if (addr->sa_family == AF_INET) { freeaddrinfo(ores); goto numeric; } ! } break; } ((struct sockinet *)addr)->si_port = port; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message