Browse Source

[1722] fix tab escape in whitespace replacer

Jelte Jansen 13 years ago
parent
commit
a756c80131
2 changed files with 12 additions and 1 deletions
  1. 1 1
      src/lib/dns/masterload.cc
  2. 11 0
      src/lib/dns/tests/masterload_unittest.cc

+ 1 - 1
src/lib/dns/masterload.cc

@@ -55,7 +55,7 @@ stripLine(string& s, const Exception& ex) {
         s.resize(pos_semicolon);
     }
     // Remove any trailing whitespace return the resulting text.
-    s.resize(s.find_last_not_of(" /t") + 1);
+    s.resize(s.find_last_not_of(" \t") + 1);
     return (s);
 }
 }

+ 11 - 0
src/lib/dns/tests/masterload_unittest.cc

@@ -230,6 +230,17 @@ TEST_F(MasterLoadTest, loadRRWithEOLWhitespace) {
                                       "1 0 1 beef")));
 }
 
+TEST_F(MasterLoadTest, loadRRWithEOLWhitespaceTab) {
+    // Similar to the previous one, but there's no space before comments.
+    // It should still work.
+    rr_stream << "example.com. 3600 IN NSEC3PARAM 1 0 1 beef\t\n";
+    masterLoad(rr_stream, origin, zclass, callback);
+    ASSERT_EQ(1, results.size());
+    EXPECT_EQ(0, results[0]->getRdataIterator()->getCurrent().compare(
+                  *rdata::createRdata(RRType::NSEC3PARAM(), zclass,
+                                      "1 0 1 beef")));
+}
+
 TEST_F(MasterLoadTest, loadRRNoComment) {
     // A semicolon in a character-string shouldn't confuse the parser.
     rr_stream << "example.com. 3600 IN TXT \"aaa;bbb\"\n";