From owner-freebsd-bugs@freebsd.org Sun Feb 4 22:28:57 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAD8CED6D00 for ; Sun, 4 Feb 2018 22:28:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 63B1F7531E for ; Sun, 4 Feb 2018 22:28:57 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id A90E12147A for ; Sun, 4 Feb 2018 22:28:56 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w14MSujH065994 for ; Sun, 4 Feb 2018 22:28:56 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w14MSush065993 for freebsd-bugs@FreeBSD.org; Sun, 4 Feb 2018 22:28:56 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 225668] tcsh: reads /etc/hosts and calls name resolution erroneously to find REMOTEHOST Date: Sun, 04 Feb 2018 22:28:56 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 11.1-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: jilles@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status short_desc cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Feb 2018 22:28:58 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D225668 Jilles Tjoelker changed: What |Removed |Added ---------------------------------------------------------------------------- Status|New |Open Summary|'su' command reads |tcsh: reads /etc/hosts and |/etc/hosts and calls name |calls name resolution |resolution erroneously |erroneously to find | |REMOTEHOST CC| |jilles@FreeBSD.org --- Comment #1 from Jilles Tjoelker --- Using ktrace -i on a su command, I found that it is not su, but csh that do= es these strange DNS requests. The code tries to set the REMOTEHOST environment variable and is in contrib/tcsh/tc.func.c getremotehost(). This exact problem is called out in a comment: /* * There is conflict with IPv6 address and X DISPLAY. So, * we assume there is no IPv6 address in utmp and don't * touch here. */ However, the assumption is wrong. There can be IPv6 addresses in utmp(x). A simple fix would be to use inet_pton() or getaddrinfo() with AI_NUMERICHO= ST to check for an IPv6 (or also IPv4) address, and to skip the X DISPLAY hand= ling in that case. This fix should be submitted to the upstream tcsh project first. However, perhaps we want to eliminate more obsolete code here. The name of = the remote host is rather less important now for shell startup files than it us= ed to be when the code was written (such as to deal with terminal settings). It may be sufficient to extract a hostname from the utmp host without touching= DNS at all. Fortunately, there is a 2 second timeout on finding the remote hostname, so= it will not prevent you from logging in. The "leaked" information is just the top 16 bits of the IPv6 address togeth= er with the local DNS domain; perhaps the most important part is that you su'e= d at that time. --=20 You are receiving this mail because: You are the assignee for the bug.=