Skip Menu |

This queue is for tickets about the Net-DNS CPAN distribution.

Report information
The Basics
Id: 8803
Status: resolved
Priority: 0/
Queue: Net-DNS

People
Owner: OLAF [...] cpan.org
Requestors: twilde [...] dyndns.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.48
Fixed in: 0.49



Subject: TXT records don't work with semicolons
Semicolons aren't allowed in TXT records because of the way Net::DNS::RR::new_from_string parses out comments. Test case: my $rr = Net::DNS::RR->new_from_string('badtxt.krellis.us. 1234 TXT "something ; something else"'); print '"',$rr->rr_rdata,'"',"\n"; This code prints out "", whereas: my $rr = Net::DNS::RR->new_from_string('badtxt.krellis.us. 1234 TXT "something something else"'); print '"',$rr->rr_rdata,'"',"\n"; prints out "something something else" as expected. The semicolon should be allowed inside a double-quoted string for a TXT record.
From: Dan Lundqvist
[guest - Thu Dec 9 12:22:05 2004]: Show quoted text
> Semicolons aren't allowed in TXT records because of the way > Net::DNS::RR::new_from_string parses out comments. Test case: > > my $rr = Net::DNS::RR->new_from_string('badtxt.krellis.us. 1234 TXT > "something ; something else"'); > print '"',$rr->rr_rdata,'"',"\n"; > > This code prints out "", whereas: > > my $rr = Net::DNS::RR->new_from_string('badtxt.krellis.us. 1234 TXT > "something something else"'); > print '"',$rr->rr_rdata,'"',"\n"; > > prints out "something something else" as expected. The semicolon > should be allowed inside a double-quoted string for a TXT record.
After some investigation of the code, i found the executing part that is direct responsible for this problem. Net::DNS::RR lib/Net/DNS/RR.pm row 253-254 # strip out comments $rrstring =~ s/;.*//g; --- With the example above, the result of this row commented gives "→something ; something else" insted of " ". Some traces was done before and after this row printing out $rrstring and it will give the following: $rrstring =~ s/;.*//g; Gives = $rrstring = badtxt.krellis.us. 1234 TXT "something # $rrstring =~ s/;.*//g; Gives = $rrstring = badtxt.krellis.us. 1234 TXT "something ; something else" Observe that this is ONLY findings during debugging of module to try to narrow down exactly where in the code it goes wrong. Someone needs to look into this a bit further to come up with a robust correction that will resolve this issue permamently. Due to upcomming "Yahoo Domainkeys", that requires semicolon as part of the record it's crusial that this problems gets resolved ASAP. http://antispam.yahoo.com/domainkeys http://www.ietf.org/internet-drafts/draft-delany-domainkeys-base-01.txt Dan Lundqvist MRZAZ.COM mylists@mrzaz.com Stockholm, Sweden
Since we are expecting "zonefile" presentation at input a comment will need to be escaped. It could be argued that this is a to strict interpertation of 1035 section 5.1. While working on this I discovered there are more problems with TXT RRs. Eg; 0100 is a perfectly legal character string that should be represented as "\000" in a zonefile. Net::DNS does pass character strings with "non-ASCII" chars from the wire to the char_str_lst array but the print functions do not properly escape them when prining. Properly dealing with zonefile presentation format and binary data is still to be done. Turns out that Net::DNS is pretty liberal about the use of ' or " for character string separators. $TXTrr2=Net::DNS::RR->new('txt2.t.net-dns.org. 60 IN TXT "Test1 \" \; more stuff" "Test2"'); works like a charm and produces two character strings one containing Test1 " ; more stuff the other containing Test2 $TXTrr3 = Net::DNS::RR->new("baz.example.com 3600 HS TXT '\"' 'Char Str2'"); works too and produces: " and Str2 $TXTrr5 = Net::DNS::RR->new("baz.example.com 3600 HS TXT '\'' 'Char Str2'"); fails to parse... The patch, a simple look-behind assertion to see if the ";" is escaped, lives in the subversion repository trunk (as of revision 196) http://www.net-dns.org/svn/net-dns/trunk/
From: twilde [...] dyndns.org
[OLAF - Fri Feb 11 11:21:07 2005]: Show quoted text
> The patch, a simple look-behind assertion to see if the ";" is escaped, > lives in the subversion repository trunk (as of revision > 196) http://www.net-dns.org/svn/net-dns/trunk/
This fix looks good in 0.49. Thanks, Olaf!