Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2001 15:19:09 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Dag-Erling Smorgrav <des@ofug.org>
Cc:        arch@FreeBSD.ORG
Subject:   Re: Generating host.conf for backward compatibility 
Message-ID:  <20011013221909.80C3A3810@overcee.netplex.com.au>
In-Reply-To: <xzplmifh5er.fsf_-_@flood.ping.uio.no> 

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011013221909.80C3A3810>