From owner-freebsd-arch@FreeBSD.ORG Mon Oct 3 18:03:47 2005 Return-Path: X-Original-To: arch@freebsd.org Delivered-To: freebsd-arch@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6EFA716A41F for ; Mon, 3 Oct 2005 18:03:47 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1823543D45 for ; Mon, 3 Oct 2005 18:03:44 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.13.0/8.13.0) with ESMTP id j93I3i8l001306; Mon, 3 Oct 2005 11:03:44 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.13.0/8.13.0/Submit) id j93I3i31001305; Mon, 3 Oct 2005 11:03:44 -0700 Date: Mon, 3 Oct 2005 11:03:44 -0700 From: Brooks Davis To: Ceri Davies , Brooks Davis , arch@freebsd.org Message-ID: <20051003180344.GA31888@odin.ac.hmc.edu> References: <20051001093550.GA32354@odin.ac.hmc.edu> <20051003103124.GB56760@submonkey.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="AhhlLboLdkugWU4S" Content-Disposition: inline In-Reply-To: <20051003103124.GB56760@submonkey.net> User-Agent: Mutt/1.4.1i X-Virus-Scanned: by amavisd-new X-Spam-Status: No, hits=0.0 required=8.0 tests=none autolearn=no version=2.63 X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on odin.ac.hmc.edu Cc: Subject: Re: error in trimdomain(3) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2005 18:03:47 -0000 --AhhlLboLdkugWU4S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 03, 2005 at 11:31:24AM +0100, Ceri Davies wrote: > On Sat, Oct 01, 2005 at 02:35:50AM -0700, Brooks Davis wrote: > > I discovered today that the trimdomain() implementation in libutil devi= ates > > slightly from the manpage. The manpage says: > >=20 > > The function trimdomain() removes the current domain name from the= passed > > fullhost name by writing a NUL character over the first period of = the > > ^^^^^^^^^^^^ > > passed name. The current domain name is determined by calling > > gethostname(3) and removing everything up to the first period. > >=20 > > which clearly indicates that trimdomain() should return either the > > unmodified string or a host name with no domain. In reality it will > > remove the domain name even if the result is not a host name. This > > means that if the host b.com calls trimdomain with "a.b.com" as the > > input string, the result is "a.b". >=20 > That's actually what the excerpt above says will happen. >=20 > gethostname returns "b.com", removing everything up to the first period > yields ".com", and that removed from "a.b.com" gives you "a.b". >=20 > I don't care if it needs to be changed, but that does exactly what it > says on the tin so far as I can see. There are two refrences to "first period". You are correct that the domain name of b.com is .com, but the refrence I highlighted states that the only allowable modification to the host name is writing a NUL to the first period in the string (it's actually messier than this because trimdomain also supports X11 DISPLAY strings and thus does a memmove and reterminates if there is a :0 or :0.0 type string after domain.) -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --AhhlLboLdkugWU4S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFDQXJ/XY6L6fI4GtQRAmYjAKCIey3y5h+rQE4o748OBjdgP0W07ACeKnRu d2CQjPwEVv5sKBTedxVIYsY= =IxmP -----END PGP SIGNATURE----- --AhhlLboLdkugWU4S--