summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2005-09-02 05:23:42 +0000
committerBob Halley <halley@dnspython.org>2005-09-02 05:23:42 +0000
commit50696af2d785bb440b1f908b3d178dd91a5462e7 (patch)
tree048d76ed00afb13f59fb65e81420749c77935bb1
parentcc3f998ab9f6e2c592641ffd94f4f14803be98a6 (diff)
downloaddnspython-50696af2d785bb440b1f908b3d178dd91a5462e7.tar.gz
Do not reject unquoted TXT RR values The masterfile parser incorrectly
rejected TXT records where a value was not quoted. Original author: Bob Halley <halley@dnspython.org> Date: 2004-10-26 00:13:21
-rw-r--r--ChangeLog5
-rw-r--r--dns/rdtypes/ANY/TXT.py5
-rw-r--r--tests/example1
-rw-r--r--tests/example1.good1
-rw-r--r--tests/example2.good1
5 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index db390af..c6c7d83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-25 Bob Halley <halley@dnspython.org>
+
+ * 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 <halley@dnspython.org>
* 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 ec5f1c9..3426748 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 27420f1..4833201 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 f71c6d4..d80b8ed 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 64b6df5..62d6ace 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