Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!ames!dftsrv!jagmac2.gsfc.nasa.gov!jim From: jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) Newsgroups: comp.mail.sendmail Subject: Re: MX records, NAMED_BIND, and aliases in /etc/hosts Message-ID: <2871@dftsrv.gsfc.nasa.gov> Date: 23 Jul 90 12:07:50 GMT References: <2850@dftsrv.gsfc.nasa.gov> <5229@uwm.edu> Sender: news@dftsrv.gsfc.nasa.gov Reply-To: jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) Distribution: na Organization: NASA Goddard Space Flight Center Lines: 57 In article <5229@uwm.edu> jgreco@archimedes.math.uwm.edu (Joe Greco) writes: >In comp.mail.sendmail article <2850@dftsrv.gsfc.nasa.gov>, jim@jagmac2.gsfc.nasa.gov (Jim Jagielski) wrote: > >:The upshot is, I need to be able to use/query MX records (and therefore >:NAMED_BIND must be defined) but I also would like to be able to use aliases >:in /etc/hosts (after all, they are recognized in telnet, ftp, etc...). > >It is probably Not Really True that they are recognized in telnet, ftp, etc. >I'd guess if that you recompiled those clients to support name server, the >aliases would suddenly cease to function. This is probably the desirable >action, anyways, as it would be a real drag having to trace down which >lookup method was producing the wrong answers. Remember, with UNIX, library >routines are included in program binaries. If you compile a program with a >host-table library routine as opposed to a nameserver library routine, it'll >use the host table until it is blue in the face (and you are quite red with >fury). You have to recompile the puppy. > I am NOT an expert, but it is my understanding that telnet, ftp, etc MUST be using nameserver since a LOT of the places I telnet and ftp to are NOT in my /etc/hosts file (which is actually quite short). To resolve these names, I think nameserver must be "in the loop" somewhere... Of course, I may be totally wrong... I'll have to look at my source for ftpd to see how it uses BIND. My initial concern (as I stated in the message) was that the version of send- mail (5.59) that CAME with my Unixbox DID see and recognize the aliases in /etc/hosts as WELL as using BIND and MX records. When I ported 5.64, this no longer happened. I looked thru the RFCs (882 and 973) and saw the info about CNAME, but it didn't seem to do what I wanted... true I could use CNAME and the SRRF to create a CNAME record, but (as far as I understood it) that was INDEPENDENT of /etc/hosts and that was NOT what I was looking for. To figure all this out, I snagged the source for all resolver routines and really looked at them. res_search (and it's "brothers" all contact the nameserver, but gethostbyname() also looks at /etc/hosts if either BIND isn't running or if nameserver queries fail... What I did then, was pretty straightforward... after the queries are made, I added code that simply checked if the query failed due to "HOST_NOT_FOUND" If so, I then call gethostbyname, which will also query but will also peek in /etc/hosts. True, this does add time, but only when aliases are used. For fully qualified names, this is not even done. I am also surprised that not one person mentioned the use of the HOSTALIASES variable, which is something totally different... -- ======================================================================= #include =:^) Jim Jagielski NASA/GSFC, Code 711.1 jim@jagmac2.gsfc.nasa.gov Greenbelt, MD 20771 "Kilimanjaro is a pretty tricky climb. Most of it's up, until you reach the very, very top, and then it tends to slope away rather sharply."