[fpc-pascal] Portable (or at least working) version of GetDomainName()?

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Tue Apr 9 10:14:06 CEST 2013


waldo kitty wrote:

>>> [crystalball] get nslookup working first. your code should work. 
>>> [/crystalball]
>>
>> OK, that's no big deal. But it looks like GetDomainName() doesn't 
>> quite do what
>> it says on the can :-)
> 
> agreed... i was just looking around on my FPC 2.6.0 install and note the 
> following from rtl/unix/unix.pp
> 
> Function  GetDomainName:String; deprecated; // because linux only.

I saw that as well, and wouldn't have raised it if I'd not been working 
on x86 Linux. It might turn out to depend on the distro: I use Debian.

> diggin in, i note that it seems to use the system's uname function... 
> but i think that is different than the command line "uname" or "uname 
> -a" because none of my linux machine return their FQDN in this output... 
> i note that it also seems to be pulling this function from a/the libc 
> library...
> 
> i note that both, GetDomainName and GetHostName both use the same var 
> (Sysn : utsname) but just different fields in what is apparently a 
> record of some type...
> 
> can't trace further... the grill and a pork loin are calling me... not 
> to mention other mouths in the location wanting some eats soon-ish...

It might be notable that Debian doesn't volunteer a domain name unless 
it's able to contact DNS. I'll get onto nslookup, or just use temporary 
text (it's only salt for a password hash, and is stored).

-- 
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