From 6ee0baab5615e9c56411572dec8ae5df68651b2a Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Thu, 13 Jun 2013 19:41:37 +0100 Subject: [PATCH] anything escaped in domain name is legal Allow all character after a \ in a domainname. It's escaped, it's legal. --- TODO.markdown | 1 + defaults.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TODO.markdown b/TODO.markdown index 9190be3c..2610f71a 100644 --- a/TODO.markdown +++ b/TODO.markdown @@ -7,6 +7,7 @@ * Make compare/split labels faster * Ratelimiting? * Have infrastructure to keep track of outbound queries and hold some +* Check if \DDD is properly parsed: text/network/etc. ## Nice to have diff --git a/defaults.go b/defaults.go index d4b53388..bb172c8c 100644 --- a/defaults.go +++ b/defaults.go @@ -189,7 +189,11 @@ func IsDomainName(s string) (uint8, uint8, bool) { // copied from net package. c = s[i] switch { default: - return 0, uint8(l - longer), false + // anything escaped is legal + if last != '\\' { + return 0, uint8(l - longer), false + } + partlen++ case 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' || c == '_' || c == '*' || c == '/': ok = true partlen++