better handle recursive includes

This commit is contained in:
Miek Gieben 2012-01-21 23:42:33 +01:00
parent 2718f6f23a
commit 01cb137157
1 changed files with 15 additions and 15 deletions

View File

@ -117,6 +117,9 @@ func parseZone(r io.Reader, f string, t chan Token, include int) {
close(t) close(t)
} }
}() }()
if include > 7 {
t <- Token{Error: &ParseError{f, "Too deeply nested $INCLUDE", l}}
}
var s scanner.Scanner var s scanner.Scanner
c := make(chan lex) c := make(chan lex)
s.Init(r) s.Init(r)
@ -192,9 +195,6 @@ func parseZone(r io.Reader, f string, t chan Token, include int) {
t <- Token{Error: &ParseError{f, "Failed to open `" + l.token + "'", l}} t <- Token{Error: &ParseError{f, "Failed to open `" + l.token + "'", l}}
return return
} }
if include+1 > 8 {
t <- Token{Error: &ParseError{f, "Too deeply nested $INCLUDE", l}}
}
parseZone(r1, l.token, t, include+1) parseZone(r1, l.token, t, include+1)
st = _EXPECT_OWNER_DIR st = _EXPECT_OWNER_DIR
case _EXPECT_DIRTTL_BL: case _EXPECT_DIRTTL_BL: