]> granicus.if.org Git - pdns/commitdiff
pdns: RecordTextReader - trim whitespace
authorAki Tuomi <cmouse@cmouse.fi>
Mon, 8 Jan 2018 10:34:00 +0000 (12:34 +0200)
committerAki Tuomi <cmouse@cmouse.fi>
Mon, 8 Jan 2018 10:52:25 +0000 (12:52 +0200)
DNS records should not care if there is whitespace around them.

pdns/rcpgenerator.cc

index c31579f76fa31e0c8454c32a83da681d1d864e02..359009b1016cbc4ffaff2d4d327445143a65bceb 100644 (file)
 #include "misc.hh"
 #include "utility.hh"
 #include <boost/algorithm/string.hpp>
+#include <boost/algorithm/string/classification.hpp>
+
 #include <iostream>
 #include "base32.hh"
 #include "base64.hh"
 #include "namespaces.hh"
 
-RecordTextReader::RecordTextReader(const string& str, const string& zone) : d_string(str), d_zone(zone), d_pos(0), d_end(str.size())
+RecordTextReader::RecordTextReader(const string& str, const string& zone) : d_string(str), d_zone(zone), d_pos(0)
 {
+   /* remove whitespace */
+   boost::trim_if(d_string, boost::algorithm::is_space());
+   d_end = d_string.size();
 }
 
 void RecordTextReader::xfr48BitInt(uint64_t &val)