Allow underscore in domain names while resolving. While having underscore

is a violation of RFC 1034 [STD 13], it is accepted by certain name servers
as well as other popular operating systems' resolver library.

Bugs are mine.

Obtained from:	ume
MFC after:	2 weeks
This commit is contained in:
Xin LI 2008-02-16 00:16:49 +00:00
parent 5a2e3b61ce
commit 5435230b4d

View File

@ -140,6 +140,7 @@ dn_skipname(const u_char *ptr, const u_char *eom) {
#define PERIOD 0x2e
#define hyphenchar(c) ((c) == 0x2d)
#define bslashchar(c) ((c) == 0x5c)
#define underscorechar(c) ((c) == 0x5f)
#define periodchar(c) ((c) == PERIOD)
#define asterchar(c) ((c) == 0x2a)
#define alphachar(c) (((c) >= 0x41 && (c) <= 0x5a) \
@ -147,7 +148,7 @@ dn_skipname(const u_char *ptr, const u_char *eom) {
#define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
#define borderchar(c) (alphachar(c) || digitchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c))
#define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
#define domainchar(c) ((c) > 0x20 && (c) < 0x7f)
int