Resolution differences for getaddrinfo versus host/dig/delv

Mark Andrews marka at isc.org
Wed Nov 18 23:41:32 UTC 2015


	
And whomever added underscorechar() to that should be shot.  There
are good reasons to be able to distingish hostnames from other sorts
of text.  Adding '_' doesn't help one do that as it is impossible to
distinguish underscored text from underscored hostnames. 

	This_is_a_title

Mark
	
In message <20151118212633.GA18852 at sources.org>, Stephane Bortzmeyer writes:
> On Wed, Nov 18, 2015 at 12:19:57PM +0000,
>  Phil Mayers <p.mayers at 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 at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users

-- 
Mark Andrews, ISC
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: marka at isc.org


More information about the bind-users mailing list