[1154] in bugtraq

home help back first fref pref prev next nref lref last post

Re: Bug in gethostbyaddr() on some systems

daemon@ATHENA.MIT.EDU (Lawrence MacIntyre - 615.576.0824)
Thu Mar 2 12:36:41 1995

Date: Thu, 2 Mar 1995 10:08:44 -0500 (EST)
From: "Lawrence MacIntyre - 615.576.0824" <lpz@nautique.epm.ornl.gov>
To: Jon Peatfield <J.S.Peatfield@amtp.cam.ac.uk>
Cc: bugtraq@fc.net, jp107@amtp.cam.ac.uk, pvu@ornl.gov
In-Reply-To: <m0rjqu5-0000ocC%kro.amtp.cam.ac.uk@damtp.cambridge.ac.uk>

On Wed, 1 Mar 1995, Jon Peatfield wrote:

> Both DECs (OSF/1 1.3, 2.0, 3.0) and HPs (if you apply certain libc patches 
> (e.g. PHCO_5153 etc) to get nsswitch.conf stuff) have a bug in gethostbyaddr() 
> if you have set the search order in nsswitch.conf/svc.conf to 
> files,dns/local,bind.  That is if you have set the resolver code to look in 
> the /etc/hosts file first and then go on to look in the DNS for results.  
> Other orders may also have bugs I've not investigated this.
> 
> The bug causes the h_aliases field of the hostent struct to get filled in with 
> stuff from the last valid line in your /etc/hosts rather than whatever it 
> should get.
> 
> Fortunately there is a simple fix -- just add a dummy line with no aliases to 
> the end of your /etc/hosts file, the following appears to work for me:
> 
> # Dummy entry to work round bug in gethostbyaddr() on HP/DEC
> 127.0.0.1        GARBAGENAME

I tested this on OSF/1 v2.0 and v3.0.  My machines did something a bit 
different.  The h_aliases pointer pointed into the middle of the h_name 
data.  There was no sign of any aliases from /etc/hosts.  However, 
putting a bogus line as the last line in the host file did fix the problem. 

                                 Lawrence
                                    ~
-------------------------------------------------------------------------------
lpz@nautique.epm.ornl.gov                                    Lawrence MacIntyre 
lpz@ornl.gov             Oak Ridge National Laboratory          615.574.8696


home help back first fref pref prev next nref lref last post