Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding FQDN on Darwin



On Wednesday, February 25, 2004, at 09:52 AM, Bill Janssen wrote:

The real issue is what his ultimate aim is, since "the" FQDN is
ill-defined.

Sure. How about *a* FQDN, or a list of all applicable FQDN's, or
"what the Python standard library function socket.getfqdn() returns",
or "what uname -n outputs", or...

For example, the ILU configuration script fqdn.sh first looks at the
output of "uname -n", then if that doesn't return a dotted name, tries
the output of "hostname", then tries "nslookup `uname -n`", then, if
all that fails, in desperation checks the banner message from the
local SMTP server.

First, check the calls 'getaddrinfo()' and 'getnameinfo()'. These are fairly portable, but fairly new (e.g., they don't show up on early Mac OS X versions).

Next, be aware that 'uname' and 'hostname' are both, inherently, orthogonal to, i.e., independent of, anything having to do with DNS. 'uname' just reports what 'hostname' told it to say, and 'hostname' doesn't have any bone fides (check the darwin development list, where this was discussed in nauseating detail recently).

Generally, you want to use DNS to get DNS info. One of the problems recently seen was due to a fouled up installation, that had a user's login name ("admin") as the hostname. This caused some grief...

Something like the script you mention is worth a shot, but I think it ends up relying on the same kind of information.

Hope that helps.

Regards,

Justin

--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | If you're not confused,
| You're not paying attention
*--------------------------------------*-------------------------------*
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.




Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.