]> granicus.if.org Git - pdns/commitdiff
fix up zone2sql for prio-mismatching
authorBert Hubert <bert.hubert@netherlabs.nl>
Sun, 25 Mar 2007 18:04:42 +0000 (18:04 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Sun, 25 Mar 2007 18:04:42 +0000 (18:04 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@995 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/backends/bind/zone2sql.cc

index e00688affed536e055ec1e0b992ffe5555dc43b9..61866cd6a20de81dff7b9ae5569fb61ba9ef5c6f 100644 (file)
@@ -39,7 +39,10 @@ using namespace std;
 #include "misc.hh"
 #include "dnspacket.hh"
 #include "zoneparser-tng.hh"
+#include "dnsrecords.hh"
+#include <boost/algorithm/string.hpp>
 
+using namespace boost;
 StatBag S;
 
 static const string sqlstr(const string &name)
@@ -105,6 +108,16 @@ static void callback(unsigned int domain_id,const string &domain, const string &
     lastsoa_qname=stripDot(domain);
   }
   
+  if(qtype == "MX" || qtype == "SRV") { 
+    prio=atoi(content.c_str());
+    
+    string::size_type pos = content.find_first_not_of("0123456789");
+    if(pos != string::npos)
+      erase_head(content, pos);
+    trim_left(content);
+  }
+
+
   lastsoa_domain_id=dirty_hack_num;
 
   if(mode==MYSQL) {
@@ -151,6 +164,7 @@ ArgvMap &arg()
 int main(int argc, char **argv)
 {
   try {
+    reportAllTypes();
 #if __GNUC__ >= 3
     ios_base::sync_with_stdio(false);
 #endif