OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Bugtraq archives for 1st quarter (Jan-Mar) 1995: Re: Bug in gethostbyaddr() on some systems

Re: Bug in gethostbyaddr() on some systems

Lawrence MacIntyre - 615.576.0824 (lpznautique.epm.ornl.gov)
Thu, 2 Mar 1995 10:08:44 -0500 (EST)

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
                                    ~
-------------------------------------------------------------------------------
lpznautique.epm.ornl.gov                                    Lawrence MacIntyre 
lpzornl.gov             Oak Ridge National Laboratory          615.574.8696