Commit 3e9a6942 authored by Mukund Sivaraman's avatar Mukund Sivaraman

[2535] Test that TXTLike data is escaped correctly when written to database

parent a6ce7e43
......@@ -435,4 +435,23 @@ TEST_P(ZoneFinderContextTest, getAdditionalWithRRSIGOnly) {
result_sets_.begin(), result_sets_.end());
}
TEST(ZoneFinderContextSQLite3Test, escapedText) {
// This test checks that TXTLike data, when written to a database,
// is escaped correctly before stored in the database. The actual
// escaping is done in the toText() method of TXTLike objects, but
// we check anyway if this also carries over to the ZoneUpdater.
RRClass zclass(RRClass::IN());
Name zname("example.org");
stringstream ss("escaped.example.org. 3600 IN TXT Hello~World\\;\\\"");
DataSourceClientPtr client = createSQLite3Client(zclass, zname, ss);
ZoneFinderPtr finder = client->findZone(zname).zone_finder;
// If there is no escaping, the following will throw an exception
// when it tries to construct a TXT RRset using the data from the
// database.
ZoneFinderContextPtr ctx = finder->find(Name("escaped.example.org"),
RRType::TXT());
EXPECT_EQ(ZoneFinder::SUCCESS, ctx->code);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment