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

[leafnode-list] fqdn validation

Here's something I forgot to bring up earlier when I got leafnode 1.9.20/21
going on my machine...

validatefqdn() checks that the fqdn isn't localhost. However fqdn is set by
miscutil.c:whoami() which includes:

    if (!gethostname(fqdn, 255) && (he = gethostbyname(fqdn)) != NULL) {
        strncpy(fqdn, he->h_name, 255);
        if (strchr(fqdn, '.') == NULL) {
         [ use a DNS alias ]

The thing is that although I set up a valid fqdn (foo.bar.org) with a
sensible IP addr, my system has its /etc/hosts set up such that foo.bar.org
is address, i.e.:		localhost.localdomain localhost foo.bar.org foo

This is to cut out overhead for times where the machine connects to itself,
and is in fact how Red Hat Linux sets itself up by default.

The problem is that the above code results in he->h_name being set to
localhost.localdomain since that is the canonical name (and for
that's correct). This then causes validatefqdn() to complain.

I think the correct answer is simply to delete the strncpy(). Setting fqdn
to the canonical name won't really achieve much since using an alias should
have the same effect anyway. And the checking for localhost in
validatefqdn() isn't intended to prevent configurations like this.

If people agree, it would be nice to have this in any eventual 1.9.22. I
don't see any checking any longer in the 2.0b series, so presumably it
wouldn't have this problem.

Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
Maybe this world is another planet's Hell -Aldous Huxley || Opinions==mine

leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list