[fpc-pascal] Resolving a local hostnames to an IP address

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Apr 17 09:27:11 CEST 2012


waldo kitty wrote:

[...]

> not sure about that on windows... i just did a search in this w2k box... 
> because it is different than my previous w98 box... the hosts file is 
> found in %systemdir%/drivers/etc where on w98 it was found in 
> %systemdir%... there is no resolv* found anywhere in my OS base 
> directory... i also have this machine configured for pseudo-static IP 
> assignment via DHCP so all address, gateway and DNS settings come from 
> my DHCP server which just happens to be my main firewall box... that box 
> is specifically configured to set a DNS suffix of my internal LAN domain 
> TLD for all lookups with one or less dots in the name ie: foo and foo. 
> both return the same IP... foo. returns just the name as given with the 
> IP and foo (without the dot) returns the name with the domain suffix 
> added and the same IP as foo. returns...

Bear in mind that files of that type are very much optional on Windows, 
a sop to those who demanded them in order to implement things like innd 
so they could claim it was as good as Unix. My experience is that the 
nameserver addresses are available from the Windows registry if 
configured statically, I suspect- but I've not checked and aren't going 
to- that that sort of thing will be copied into the registry if it 
arrives using DHCP.

[...]

> does this make sense and/or help any at all? it may be that some portion 
> of your problem comes from a partially configured DNS setup on the 
> client end of things (ie: the default domain suffix to add) but it may 
> also extend to the DNS server as well if it is not configured to return 
> proper responses for these lookups... in the past, i have seen local 
> lookups traversing to the WAN and lookups being attempted out there that 
> should never have left the LAN... there are many thousands of networks 
> that erroneously do this which leads to the leaking of internal machine 
> names and possibly roles (determined by the name)...

No. The issue is solely that resolve.pas doesn't refer to the searchpath 
(no criticism intended), this is explicitly noted in fcl-net's readme 
file. For unqualified lookups on unix you need to use cnetdb, i.e. go 
via libc, or parse resolv.conf in application code.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list