RP records ''someperson.example.com. .''

"Klaus P. Ohrhallinger" <[email protected]>
Newsgroups gmane.network.dns.powerdns.devel
Message-ID <[email protected]>
Hello!

Recently I performed a BIND to PowerDNS migration of a quite large setup.
The only issue I couldn't solve without touching the code was
RP records of this form:
''someperson.example.com. .''
which is perfectly fine with RFC 1183:
----8<----
The root domain name (just ".") may be
specified for <txt-dname> to indicate that the TXT_DNAME is absent,
and no associated TXT RR exists.
----8<----

In the pdns databases (postgres) it ends up as:
''someperson.example.com ''
which leads to an exception in RecordTextReader::skipSpaces().

dnsrecords.cc:
boilerplate_conv(RP, ns_t_rp,
                 conv.xfrLabel(d_mbox);
                 conv.xfrLabel(d_info)
                 );

--> xfrLabel() --> skipSpaces() --> exception.

This is how I worked around the problem:

--- pdns-3.3-orig/pdns/rcpgenerator.cc  2013-05-15 14:23:28.000000000 +0200
+++ pdns-3.3/pdns/rcpgenerator.cc       2013-10-07 05:43:56.493536239 +0200
@@ -179,6 +179,11 @@ void RecordTextReader::xfrLabel(string&
 { 
   skipSpaces();
   val.clear();
+  if (d_pos == d_end) {
+    /* '.' is a valid label which is '' in pdns database */
+    val = "";
+    return;
+  }
   val.reserve(d_end - d_pos);

   const char* strptr=d_string.c_str();
@@ -362,8 +367,10 @@ void RecordTextReader::skipSpaces()
   const char* strptr = d_string.c_str();
   while(d_pos < d_end && dns_isspace(strptr[d_pos]))
     d_pos++;
+  /*
   if(d_pos == d_end)
     throw RecordTextException("missing field at the end of record content '"+d_string+"'");
+  */
 }

I don't think this is a proper way of dealing with the issue.
Has someone got a better idea ?

Thanks,
Klaus
-- 
	* * * * * * http://www.ipv6actnow.org/ * * * * * *
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.