Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: rad [...] twig.com
torsten [...] archesoft.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: (no value)



Subject: Creating a TXT record for DKIM / Escaping the ;
Hello, my Perl: see perlversion.txt Net::DNS 0.65 bind 9.5.0-P2 I am trying to create a TXT record for use with the domainkey system. An example of the data part would be "v=DKIM1\; k=rsa\; t=y\; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB" If i send the update (see and use the dnsupdate.pl [contains real data]), the data part is escaped twice again. i.e. "v=DKIM1\\\; k=rsa\\\; t=y\\\; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB" If i put the TXT record manually into a zone file, the server returns the expected result, so i assume, the escaping is a "bug" in Net::DNS Probably it's only an error on my side, if so, apologize and please tell me, what i did wrong. Thanks Torsten
Subject: dnsupdate.pl
#!/usr/bin/perl use Net::DNS; use Digest::MD5("md5_hex"); $t = 'v=DKIM1\; k=rsa\; t=y\; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB'; $rt = "porgy._domainkey.test3.com. IN TXT '$t'"; upd($rt); exit; sub upd { my $ru = shift; my $update = Net::DNS::Update->new("test3.com"); $update->push("update", rr_del("porgy._domainkey.test3.com. IN TXT")); $update->push("update", rr_add($ru)); $update->sign_tsig("test3.com", "Yl1CRVlIQiZVLUldT08wSEEidm0jcFJ8aCJIWz0oZXI="); my $res = Net::DNS::Resolver->new; $res->nameservers('ns0.xtremeweb.de'); my $reply = $res->send($update); print "\n------------------------- update:\n$ru\n"; # Did it work? if ($reply) { if ($reply->header->rcode eq 'NOERROR') { print "Update succeeded\nNow make a 'host -a porgy._domainkey.test3.com. ns0.xtremeweb.de'\n"; } else { print 'Update failed: ', $reply->header->rcode, "\n"; } } else { print 'Update failed: ', $res->errorstring, "\n"; } }
Subject: perlversion.txt
Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.25, archname=i586-linux-thread-multi uname='linux bach 2.6.25 #1 smp preempt rt 2008-06-04 00:52:17 +0200 i686 i686 i386 gnulinux ' config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true -Doptimize=-O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe', cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe' ccversion='', gccversion='4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags ='' libpth=/lib /usr/lib /usr/local/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.8.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.8' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.10.0/i586-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL PERL_USE_SAFE_PUTENV USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Jun 6 2008 18:39:56 @INC: /usr/lib/perl5/5.10.0/i586-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .
Subject: Re: [rt.cpan.org #43190] Creating a TXT record for DKIM / Escaping the ;
Date: Tue, 10 Feb 2009 23:56:48 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Olaf Kolkman <olaf [...] dacht.net>
Within the enclosing quotes of the character string I don't think the backslash escapes are needed. Could you try without those backslashes? I would have to go back to the RFCs to double check the specs, and or test interoperability with other parsers. Will do that later. --Olaf On 10 feb 2009, at 23:48, torsten@archesoft.de via RT wrote: Show quoted text
> Tue Feb 10 17:48:38 2009: Request 43190 was acted upon. > Transaction: Ticket created by torsten@archesoft.de > Queue: Net-DNS > Subject: Creating a TXT record for DKIM / Escaping the ; > Broken in: (no value) > Severity: Normal > Owner: Nobody > Requestors: torsten@archesoft.de > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=43190 > > > > Hello, > my Perl: see perlversion.txt > Net::DNS 0.65 > bind 9.5.0-P2 > > I am trying to create a TXT record for use with the domainkey system. > An example of the data part would be > "v=DKIM1\; k=rsa\; t=y\; > p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB" > > If i send the update (see and use the dnsupdate.pl [contains real > data]), > the data part is escaped twice again. > i.e. > "v=DKIM1\\\; k=rsa\\\; t=y\\\; > p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB" > > If i put the TXT record manually into a zone file, the server returns > the expected result, so i assume, the escaping is a "bug" in Net::DNS > > Probably it's only an error on my side, if so, apologize and please > tell > me, what i did wrong. > > Thanks Torsten > > <dnsupdate.pl>Summary of my perl5 (revision 5 version 10 subversion > 0) configuration: > Platform: > osname=linux, osvers=2.6.25, archname=i586-linux-thread-multi > uname='linux bach 2.6.25 #1 smp preempt rt 2008-06-04 00:52:17 > +0200 i686 i686 i386 gnulinux ' > config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr - > Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm - > Duseshrplib=true -Doptimize=-O2 -march=i586 -mtune=i686 -fmessage- > length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe - > Accflags=-DPERL_USE_SAFE_PUTENV' > hint=recommended, useposix=true, d_sigaction=define > useithreads=define, usemultiplicity=define > useperlio=define, d_sfio=undef, uselargefiles=define, > usesocks=undef > use64bitint=undef, use64bitall=undef, uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE - > DPERL_USE_SAFE_PUTENV -DDEBUGGING -fno-strict-aliasing -pipe - > D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', > optimize='-O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall - > D_FORTIFY_SOURCE=2 -fstack-protector -g -Wall -pipe', > cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV - > DDEBUGGING -fno-strict-aliasing -pipe' > ccversion='', gccversion='4.3.1 20080507 (prerelease) [gcc-4_3- > branch revision 135036]', gccosandvers='' > intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, > Off_t='off_t', lseeksize=8 > alignbytes=4, prototype=define > Linker and Libraries: > ld='cc', ldflags ='' > libpth=/lib /usr/lib /usr/local/lib > libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc > perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc > libc=/lib/libc-2.8.so, so=so, useshrplib=true, libperl=libperl.so > gnulibc_version='2.8' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E - > Wl,-rpath,/usr/lib/perl5/5.10.0/i586-linux-thread-multi/CORE' > cccdlflags='-fPIC', lddlflags='-shared -O2 -march=i586 - > mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack- > protector -g -Wall -pipe' > > > Characteristics of this binary (from libperl): > Compile-time options: DEBUGGING MULTIPLICITY PERL_DONT_CREATE_GVSV > PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP > PERL_TRACK_MEMPOOL PERL_USE_SAFE_PUTENV > USE_ITHREADS > USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API > Built under linux > Compiled at Jun 6 2008 18:39:56 > @INC: > /usr/lib/perl5/5.10.0/i586-linux-thread-multi > /usr/lib/perl5/5.10.0 > /usr/lib/perl5/site_perl/5.10.0/i586-linux-thread-multi > /usr/lib/perl5/site_perl/5.10.0 > /usr/lib/perl5/vendor_perl/5.10.0/i586-linux-thread-multi > /usr/lib/perl5/vendor_perl/5.10.0 > /usr/lib/perl5/vendor_perl > .
Download PGP.sig
application/pgp-signature 235b

Message body not shown because it is not plain text.

Hello Olaf, thanks for your response. On Di. 10. Feb. 2009, 17:57:09, olaf@dacht.net wrote: Show quoted text
> > Within the enclosing quotes of the character string I don't think the > backslash escapes are needed. > > Could you try without those backslashes?
I already tried with $t = 'v=DKIM1; k=rsa; t=y; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB'; instead of $t = 'v=DKIM1\; k=rsa\; t=y\; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB'; but this gave "Update failed: FORMERR" If you like, i can try to look with "Data::Dumper" what Net::DNS tries to send in case of the "FORMERR" Greetings Torsten
Subject: Re: [rt.cpan.org #43190] Creating a TXT record for DKIM / Escaping the ;
Date: Wed, 11 Feb 2009 01:32:47 +0100
To: bug-Net-DNS [...] rt.cpan.org
From: Torsten Mueller <torsten [...] archesoft.de>
Olaf M. Kolkman via RT schrieb: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=43190 > > > > Within the enclosing quotes of the character string I don't think the > backslash escapes are needed. > > Could you try without those backslashes?
I already tried with $t = 'v=DKIM1; k=rsa; t=y; p=DEFfMA074X/SR+BW8yd4RaXMk+pSDwnr/SjT/b+HTNoZmxfkrYqk5eN5jnUewIDAQAB'; but this gave "Update failed: FORMERR" I uploaded the miniscript dnsupdate.pl. If you like you can use it against my live nameserver to see what i mean / to test. Greetings Torsten
Subject: Net::DNS::RR.pm breaks quoted strings with semicolon +FIX
Date: Fri, 24 Apr 2009 22:26:31 +0000
To: bug-net-dns [...] rt.cpan.org
From: rad [...] twig.com (Richard Doty)
The new_from_string function in RR.pm strips comments: 19 $VERSION = (qw$LastChangedRevision: 705 $)[1]; 317 # strip out comments 318 # Test for non escaped ";" by means of the look-behind assertion 319 # (the backslash is escaped) 320 $rrstring =~ s/(?<!\\);.*//og; This breaks quoted strings that contain semicolons. The enclosed patch adds a test for an enclosing quote. I think this will fix bug 43190 as well. Richard *** RR.pm Fri Apr 24 21:46:51 2009 --- RR.pm.new Fri Apr 24 22:14:32 2009 *************** *** 317,323 **** # strip out comments # Test for non escaped ";" by means of the look-behind assertion # (the backslash is escaped) ! $rrstring =~ s/(?<!\\);.*//og; ($rrstring =~ m/$RR_REGEX/xso) || confess qq|qInternal Error: "$rrstring" did not match RR pat.\nPlease report this to the author!\n|; --- 317,323 ---- # strip out comments # Test for non escaped ";" by means of the look-behind assertion # (the backslash is escaped) ! $rrstring =~ s/(?<!\\);[^"]*$//og; ($rrstring =~ m/$RR_REGEX/xso) || confess qq|qInternal Error: "$rrstring" did not match RR pat.\nPlease report this to the author!\n|;
The comment parsing logic has improved. Fully functional on the trunk as of 812 Note that for consistency the rdatastr method (TXT and SPF) will return escaped strings. char_str_list will continue to return unescaped values. as is reflected in the test cases below t/05-rr-txt.t my $TXTrr=Net::DNS::RR->new('txt2.t.net-dns.org. 60 IN TXT "Test1 \" \; more stuff" "Test2"'); is ( ($TXTrr->char_str_list())[0], 'Test1 " ; more stuff', "char_str_list[0] returns unescaped ;"); is ( $TXTrr->rdatastr,'"Test1 \" \; more stuff" "Test2"', "string method returns escaped ;");
The comment parsing logic has improved. Fully functional on the trunk as of 812 Note that for consistency the rdatastr method (TXT and SPF) will return escaped strings. char_str_list will continue to return unescaped values. as is reflected in the test cases below t/05-rr-txt.t my $TXTrr=Net::DNS::RR->new('txt2.t.net-dns.org. 60 IN TXT "Test1 \" \; more stuff" "Test2"'); is ( ($TXTrr->char_str_list())[0], 'Test1 " ; more stuff', "char_str_list[0] returns unescaped ;"); is ( $TXTrr->rdatastr,'"Test1 \" \; more stuff" "Test2"', "string method returns escaped ;");