lists.arthurdejong.org
RSS feed

Re: [nssldap] More patches to nss_ldap 265

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: [nssldap] More patches to nss_ldap 265



On Wed, Dec 9, 2009 at 10:24, Howard Wilkinson <howard@cohtech.com> wrote:
> Still plugging away at the Solaris compatibility fixes and have run in to the 
> classic problem of finding out what dns domain the local host is in. Need 
> this to generate the principal name for the automatic saslid generation. Has 
> anybody got a good way of doing this in the absense of the getdomainname call?

Normally, I call gethostname(), and then pass the resulting string to
gethostbyaddr(), which should return the FQDN. But that breaks if
reverse DNS is broken.

In that case, I would normally try to fix the broken rDNS. If that
wasn't possible, I guess I'd check whether the result of
gethostbyname() contains any dots, and truncate the leftmost field.
Failing that, I suppose you could check '/etc/resolv.conf' for a
'domain ...' or 'search ...' line, too. But there are a lot of
potential pitfalls, where the machine could appear to be functioning
just dandy, but with nonsensical combinations of gethostname() and
'/etc/resolv.conf'. It's a jungle.

-Ryan