On Wed, Nov 18, 2015 at 12:19:57PM +0000,
 Phil Mayers <p.may...@imperial.ac.uk> wrote 
 a message of 44 lines which said:

> I suspect getaddrinfo isn't parsing the DNS response for some reason.
...
> Obviously the *.thing on the RHS of the first CNAME is weird, but is it
> illegal?

Yes, for a *host* name (no for a *domain* name). See Tony Finch's
explanation.

In the GNU libc, the relevant code is in resolv/res_comp.c and
includes this function, which tests that a *host* name is
[a-z0-9\.\-]+ :

#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
                   || ((c) >= 0x61 && (c) <= 0x7a))
#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)

#define borderchar(c) (alphachar(c) || digitchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)

int
res_hnok(const char *dn) {
        int pch = PERIOD, ch = *dn++;

        while (ch != '\0') {
                int nch = *dn++;

                if (periodchar(ch)) {
                        (void)NULL;
                } else if (periodchar(pch)) {
                        if (!borderchar(ch))
                                return (0);
                } else if (periodchar(nch) || nch == '\0') {
                        if (!borderchar(ch))
                                return (0);
                } else {
                        if (!middlechar(ch))
                                return (0);
                }
                pch = ch, ch = nch;
        }
        return (1);
}       
_______________________________________________
Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe 
from this list

bind-users mailing list
bind-users@lists.isc.org
https://lists.isc.org/mailman/listinfo/bind-users

Reply via email to