Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!mentor.cc.purdue.edu!mace.cc.purdue.edu!abe From: abe@mace.cc.purdue.edu (Vic Abell) Newsgroups: comp.sys.next Subject: Re: host name resolution under 1.0 Message-ID: <3360@mace.cc.purdue.edu> Date: 17 Oct 89 19:52:24 GMT References: <6251@pt.cs.cmu.edu> <135@next.com> Reply-To: abe@mace.cc.purdue.edu (Vic Abell) Organization: Purdue University Lines: 43 In article <135@next.com> king@next.UUCP (Peter King) writes: >In article <6251@pt.cs.cmu.edu> eht@f.word.cs.cmu.edu (Eric Thayer) writes: >> >>Shouldn't it be possible to abbreviate names like F.WORD.CS.CMU.EDU as >>F.WORD given the above resolv.conf file? > >This behavior is standard for the 4.3 BSD gethostbyname() routine that >uses the BIND system. > >Do you have any suggestions for a better scheme? > >Peter King >NeXT Systems Software Of course there is a better scheme and it has been available for several years now. It was distributed with named 4.8 and possibly with earlier versions, too. I am uncertain of the exact date of issue, but we have been using the scheme since mid 1987. Berkeley distributed the code to support it in the 4,3BSD Tahoe release. Here's the scheme: 1) If a host name ends in a period, no subsequent rules apply. 2) If the host name contains no periods at all, then it is considered a possible alias and is matched to entries of the file named in the environment's HOSTALIASES variable. 3) If the first two rules don't apply, the supplied host name is extended separately by the default domain name and each of the default's components that have at least two elements, separated by a period, and each extension is tested against the host data base. For example, the name "mace", used in the default domain "cc.purdue.edu", would be tested as "mace.cc.purdue.edu" and then as "mace.purdue.edu". 4) If all of the above fails, then the supplied name is tested without modification. The supporting code is located in res_init.c and res_query.c of the resolver library and in some definitions in the resolv.h include file. Vic Abell