On Thu, Mar 01, 2007 at 12:29:48AM +0100, bert hubert wrote:
> I fail to reproduce the bug. PowerDNS does misparse the ( record, which is
> sad, and fixed in SVN (the fix is intrusive and should not be backported
> probably).

I guess you've found that pdns expects opening ( for multiline records
to not have anything after it.

ie.
foo TXT ( "lala"
"baba"
)

will throw away "lala" and only return "baba".
I don't think this is a big enough deal to warrant a change now that debian
is frozen since a long time.

> 
> But although we misparse the record, I don't see the other behaviour your
> mention.

The original mail in the bug report talked about a different kind of
record, not present in the example zone JvW sent.

ie.
foo TXT "lala(foobar)baba"

pdns/backends/bind/zoneparser2.cc - eatLine() seems to not respect that
the " is first, and wrongly assumes that any line which contains a ( is
a multiline record, which screws up the parsing of the rest of the
zone....

> 
> Can you give me a step-by-step so I can see your problem? I already loaded
> your zone, and added several braces to them, and reloaded etc.
> 

I've attached an updated version of the example zone which contains a
"foo.a-eskwadraat.nl" record... 

$ host -t txt foo.a-eskwadraat.nl localhost
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases:

foo.a-eskwadraat.nl descriptive text "lala\010@ txt ( \"study
association a-eskwadraat\" \"princetonplein 5\" \"nl-3584 cc utrecht\"
\"+31-30-253-4499"


> My debian contains 'pdns-2.9.20-7+b1'.
> 
> Thanks. If you get the description in to me today (UTC+2), I'll promise to
> look into it Friday.

Something like this might be whats needed.... Would be awesome if you
could verify if it's correct.


diff -uriNp pdns-2.9.20/pdns/backends/bind/zoneparser2.cc 
pdns-2.9.20-noparensintxt/pdns/backends/bind/zoneparser2.cc
--- pdns-2.9.20/pdns/backends/bind/zoneparser2.cc       2006-03-15 
19:29:38.000000000 +0100
+++ pdns-2.9.20-noparensintxt/pdns/backends/bind/zoneparser2.cc 2007-03-01 
10:46:29.000000000 +0100
@@ -201,10 +201,12 @@ bool ZoneParser::eatLine(const string& l
   static string tline;
   static string lastfirstword;
   string::size_type pos=string::npos;
+  string::size_type contentpos=string::npos;
 
   if(tline.empty()) {
+    contentpos=line.find_first_of("\"");
     pos=line.find_first_of("(");
-    if(pos!=string::npos) { // this is a line that continues
+    if((pos!=string::npos) && ((contentpos==string::npos) || 
(contentpos>pos))) { // this is a line that continues
       tline=line.substr(0,pos);
       return false;
     }

-- 
Regards,
Andreas Henriksson
; $Id: db.nl.a-eskwadraat 2753 2007-01-18 14:32:37Z root $
; Zone file for A-Eskwadraat.nl
;
; rewrite door jeroen, 2 april 2002

$TTL 1D
@       IN      SOA     ns.A-Eskwadraat.nl. sysop.A-Eskwadraat.nl. (
                                2007011301      ; serial
                                        6H      ; refresh, seconds
                                        1H      ; retry, seconds
                                        4W      ; expire, seconds
                                        1D )    ; minimum, seconds

;
; rewrite door jeroen, 2 april 2002

foo             TXT     "lala(bar)baba"

@               TXT     (
                          "Study Association A-Eskwadraat"
                          "Princetonplein 5"
                          "NL-3584 CC Utrecht"
                          "+31-30-253-4499"
                        )

                LOC     52 5 14 N  5 9 56 E  50m  10m  30m 50m

; de primary nameserver
                NS      ns

; de primary mail exchanger
                MX  10  mail
; en de vaste backup
                MX  20  mail.wolffelaar.nl.

; NS en MX records MOETEN naar een A wijzen (dus geen CNAME)
ns              A       131.211.39.72
mail            A       131.211.39.72

; VPN stuff
vpn-tunnel      A       131.211.39.77
vpns            CNAME   @
vpn             CNAME   @

; Aliassen voor sevices die over VPN moeten
ftp             CNAME   vpn-tunnel
imap            CNAME   vpn-tunnel
pop3            CNAME   vpn-tunnel
home            CNAME   vpn-tunnel
homes           CNAME   vpn-tunnel
homedirs        CNAME   vpn-tunnel

; @ heeft al records, kan dus geen CNAME zijn.
@               A       1.2.3.4

; *.a-eskwadraat.nl verwijst nu naar square
*               CNAME   @

; Voor DOMjudge/escapade:
;judge  15      CNAME   madeleine.students.cs.uu.nl.

; Erik en Judith
erik            A       83.83.35.241

; Kerberos
_kerberos       TXT     "A-ESKWADRAAT.NL"
_kerberos._udp  SRV     0 0 88 euclides.localdomain.
_kerberos._tcp  SRV     0 0 88 euclides.localdomain.

; backup NS:
@               NS      ns1.xel.nl.
                NS      ns3.xel.nl.
diff -uriNp pdns-2.9.20/pdns/backends/bind/zoneparser2.cc 
pdns-2.9.20-noparensintxt/pdns/backends/bind/zoneparser2.cc
--- pdns-2.9.20/pdns/backends/bind/zoneparser2.cc       2006-03-15 
19:29:38.000000000 +0100
+++ pdns-2.9.20-noparensintxt/pdns/backends/bind/zoneparser2.cc 2007-03-01 
10:46:29.000000000 +0100
@@ -201,10 +201,12 @@ bool ZoneParser::eatLine(const string& l
   static string tline;
   static string lastfirstword;
   string::size_type pos=string::npos;
+  string::size_type contentpos=string::npos;
 
   if(tline.empty()) {
+    contentpos=line.find_first_of("\"");
     pos=line.find_first_of("(");
-    if(pos!=string::npos) { // this is a line that continues
+    if((pos!=string::npos) && ((contentpos==string::npos) || 
(contentpos>pos))) { // this is a line that continues
       tline=line.substr(0,pos);
       return false;
     }

Reply via email to