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

Tomas Hajny XHajT03 at hajny.biz
Tue Apr 9 10:24:48 CEST 2013


On Tue, April 9, 2013 10:14, Mark Morgan Lloyd wrote:
> waldo kitty wrote:
 .
 .
>> 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).

Have you tried using unit netdb from package fcl-net? It doesn't support
Windows (and some other platforms yet), but it should work for Unix
targets. I believe that the two approaches for finding out the domain are
either getting it from the DNS or having it specified in /etc/resolv (and
both are used by unit netdb - search for DefaultDomainList).

Tomas





More information about the fpc-pascal mailing list