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

Re: A more robust krb5_get_host_realm?



Michael B Allen wrote:

> I don't need a perfect solution. It just needs to try a little harder. As
> it is it't just using gethostname and that's it. If gethostname doesn't
> return an FQDN it gives up.
> 
> After looking at Linux's net-tools (package containing the hostname
> command) I came up with the following code that emulates the logic of
> hostname --fqdn but strips a trailing '.' if present.
> 
> I'll stick it into krb5_get_host_realm and see how it works. If it
> doesn't blow up I'll post a patch.

gethostbyname(gethostname()) has been the standard way to do this since 
forever. If the current code isn't doing things that way, it's a bug.

-- 
   -- Howard Chu
   Chief Architect, Symas Corp.  http://www.symas.com
   Director, Highland Sun        http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP     http://www.openldap.org/project/