From owner-freebsd-arch Sat Oct 13 15:19:18 2001 Delivered-To: freebsd-arch@freebsd.org Received: from peter3.wemm.org (c1315225-a.plstn1.sfba.home.com [24.14.150.180]) by hub.freebsd.org (Postfix) with ESMTP id 5B9F137B403 for ; Sat, 13 Oct 2001 15:19:10 -0700 (PDT) Received: from overcee.netplex.com.au (overcee.wemm.org [10.0.0.3]) by peter3.wemm.org (8.11.0/8.11.0) with ESMTP id f9DMJ9M94666 for ; Sat, 13 Oct 2001 15:19:09 -0700 (PDT) (envelope-from peter@wemm.org) Received: from wemm.org (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 80C3A3810; Sat, 13 Oct 2001 15:19:09 -0700 (PDT) (envelope-from peter@wemm.org) X-Mailer: exmh version 2.3.1 01/18/2001 with nmh-1.0.4 To: Dag-Erling Smorgrav Cc: arch@FreeBSD.ORG Subject: Re: Generating host.conf for backward compatibility In-Reply-To: Date: Sat, 13 Oct 2001 15:19:09 -0700 From: Peter Wemm Message-Id: <20011013221909.80C3A3810@overcee.netplex.com.au> Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Dag-Erling Smorgrav wrote: > --=-=-= > > In our eagerness to switch from host.conf to nsswitch.conf, we forgot > that old binaries and libraries (COMPAT_* and tons of third-party > software for which sources might not even be available) still expect > to find /etc/host.conf, and may not work (correctly) if it doesn't > exist. I'm a bit puzzled as to why this makes a difference. The old libc resolver defaulted to "dns","files" if host.conf was missing. The file is and always was optional. Of course, that doesn't help you if you use a NIS hosts map, or if you're expecting /etc/hosts to override DNS lookups. static void init_services() { ... if ((fd = (FILE *)fopen(_PATH_HOSTCONF, "r")) == NULL) { /* make some assumptions */ service_order[0] = SERVICE_BIND; service_order[1] = SERVICE_HOSTS; service_order[2] = SERVICE_NONE; } else { while (fgets(buf, BUFSIZ, fd) != NULL && cc < SERVICE_MAX) { It has always been like this. (well, at least as far back as 1994): 1.2 (wollman 09-Aug-94): if ((fd = (FILE *)fopen(_PATH_HOSTCONF, "r")) == NULL) { 1.2 (wollman 09-Aug-94): /* make some assumptions */ 1.2 (wollman 09-Aug-94): service_order[0] = SERVICE_BIND; 1.2 (wollman 09-Aug-94): service_order[1] = SERVICE_HOSTS; 1.2 (wollman 09-Aug-94): service_order[2] = SERVICE_NONE; 1.2 (wollman 09-Aug-94): } else { 1.2 (wollman 09-Aug-94): while (fgets(buf, BUFSIZ, fd) != NULL && cc < SERVICE_MAX) { Something else must be going on. Secondly, since nsswitch.conf is the master file in the patch, it should be updated every time. Otherwise POLA will be violated if nsswitch.conf is updated and some old binaries still use old methods. Regarding COMPAT_* - none of those use host.conf, at least not in the same way that it exists for us. For example, the /compat/linux/etc/host.conf is a completely different syntax. The other COMPAT_* use different files altogether. (eg: svc.conf, service.switch, /etc/net/*, and so on). Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message