From 50696af2d785bb440b1f908b3d178dd91a5462e7 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Fri, 2 Sep 2005 05:23:42 +0000 Subject: [PATCH] Do not reject unquoted TXT RR values The masterfile parser incorrectly rejected TXT records where a value was not quoted. Original author: Bob Halley Date: 2004-10-26 00:13:21 --- ChangeLog | 5 +++++ dns/rdtypes/ANY/TXT.py | 5 +++-- tests/example | 1 + tests/example1.good | 1 + tests/example2.good | 1 + 5 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index db390afd..c6c7d838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-10-25 Bob Halley + + * dns/rdtypes/ANY/TXT.py (TXT.from_text): The masterfile parser + incorrectly rejected TXT records where a value was not quoted. + 2004-10-11 Bob Halley * dns/message.py: Added make_response(), which creates a skeletal diff --git a/dns/rdtypes/ANY/TXT.py b/dns/rdtypes/ANY/TXT.py index ec5f1c9e..34267484 100644 --- a/dns/rdtypes/ANY/TXT.py +++ b/dns/rdtypes/ANY/TXT.py @@ -48,8 +48,9 @@ class TXT(dns.rdata.Rdata): (ttype, s) = tok.get() if ttype == dns.tokenizer.EOL or ttype == dns.tokenizer.EOF: break - if ttype != dns.tokenizer.QUOTED_STRING: - raise dns.exception.SyntaxError, "expected a quoted string" + if ttype != dns.tokenizer.QUOTED_STRING and \ + ttype != dns.tokenizer.IDENTIFIER: + raise dns.exception.SyntaxError, "expected a string" if len(s) > 255: raise dns.exception.SyntaxError, "string too long" strings.append(s) diff --git a/tests/example b/tests/example index 27420f1b..4833201d 100644 --- a/tests/example +++ b/tests/example @@ -170,6 +170,7 @@ txt09 TXT "foo\010bar" txt10 TXT "foo bar" txt11 TXT "\"foo\"" txt12 TXT "\"foo\"" +txt13 TXT foo $TTL 300 ; 5 minutes u TXT "txt-not-in-nxt" $ORIGIN u.example. diff --git a/tests/example1.good b/tests/example1.good index f71c6d45..d80b8ed4 100644 --- a/tests/example1.good +++ b/tests/example1.good @@ -94,6 +94,7 @@ txt09 3600 IN TXT "foo\010bar" txt10 3600 IN TXT "foo bar" txt11 3600 IN TXT "\"foo\"" txt12 3600 IN TXT "\"foo\"" +txt13 3600 IN TXT "foo" u 300 IN TXT "txt-not-in-nxt" a.u 300 IN A 73.80.65.49 b.u 300 IN A 73.80.65.49 diff --git a/tests/example2.good b/tests/example2.good index 64b6df5c..62d6ace1 100644 --- a/tests/example2.good +++ b/tests/example2.good @@ -94,6 +94,7 @@ txt09.example. 3600 IN TXT "foo\010bar" txt10.example. 3600 IN TXT "foo bar" txt11.example. 3600 IN TXT "\"foo\"" txt12.example. 3600 IN TXT "\"foo\"" +txt13.example. 3600 IN TXT "foo" u.example. 300 IN TXT "txt-not-in-nxt" a.u.example. 300 IN A 73.80.65.49 b.u.example. 300 IN A 73.80.65.49 -- 2.47.3