Add missing checks if $ORIGIN's name is valid

Call IsDomainName() as $ORIGIN is rel. infrequent this does
not impact the parsing speed.
This commit is contained in:
Miek Gieben 2012-12-13 10:14:22 +01:00
parent d594c79d19
commit 623de14ebb
1 changed files with 8 additions and 0 deletions

View File

@ -252,6 +252,10 @@ func parseZone(r io.Reader, origin, f string, t chan Token, include int) {
case _BLANK:
l := <-c
if l.value == _STRING {
if _, _, ok := IsDomainName(l.token); !ok {
t <- Token{Error: &ParseError{f, "bad origin name", l}}
return
}
// a new origin is specified.
if !IsFqdn(l.token) {
if origin != "." { // Prevent .. endings
@ -317,6 +321,10 @@ func parseZone(r io.Reader, origin, f string, t chan Token, include int) {
if e := slurpRemainder(c, f); e != nil {
t <- Token{Error: e}
}
if _, _, ok := IsDomainName(l.token); !ok {
t <- Token{Error: &ParseError{f, "bad origin name", l}}
return
}
if !IsFqdn(l.token) {
if origin != "." { // Prevent .. endings
origin = l.token + "." + origin