BIND 10 trac2535, updated. 3e9a69424117d8f9841d76cf71dab353b6aa5435 [2535] Test that TXTLike data is escaped correctly when written to database
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Jan 4 13:25:19 UTC 2013
The branch, trac2535 has been updated
via 3e9a69424117d8f9841d76cf71dab353b6aa5435 (commit)
via a6ce7e4332223277ca50cd68a65e7e404621717c (commit)
from e17ddc8b0f6726a185e982c22dbf787351c22cdd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3e9a69424117d8f9841d76cf71dab353b6aa5435
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Jan 4 18:43:48 2013 +0530
[2535] Test that TXTLike data is escaped correctly when written to database
commit a6ce7e4332223277ca50cd68a65e7e404621717c
Author: Mukund Sivaraman <muks at isc.org>
Date: Fri Jan 4 18:04:34 2013 +0530
[2535] Split up createSQLite3Client method
-----------------------------------------------------------------------
Summary of changes:
.../datasrc/tests/zone_finder_context_unittest.cc | 30 ++++++++++++++++++--
1 file changed, 27 insertions(+), 3 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/tests/zone_finder_context_unittest.cc b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
index 6844712..0a79c7c 100644
--- a/src/lib/datasrc/tests/zone_finder_context_unittest.cc
+++ b/src/lib/datasrc/tests/zone_finder_context_unittest.cc
@@ -81,7 +81,7 @@ addRRset(ZoneUpdaterPtr updater, ConstRRsetPtr rrset) {
}
DataSourceClientPtr
-createSQLite3Client(RRClass zclass, const Name& zname) {
+createSQLite3Client(RRClass zclass, const Name& zname, stringstream& ss) {
// We always begin with an empty template SQLite3 DB file and install
// the zone data from the zone file to ensure both cases have the
// same test data.
@@ -93,7 +93,6 @@ createSQLite3Client(RRClass zclass, const Name& zname) {
// Note that neither updater nor SQLite3 accessor checks this condition,
// so this should succeed.
ZoneUpdaterPtr updater = client->getUpdater(zname, false);
- stringstream ss("ns.example.com. 3600 IN A 192.0.2.7");
masterLoad(ss, Name::ROOT_NAME(), zclass,
boost::bind(addRRset, updater, _1));
updater->commit();
@@ -101,6 +100,12 @@ createSQLite3Client(RRClass zclass, const Name& zname) {
return (client);
}
+DataSourceClientPtr
+createSQLite3ClientWithNS(RRClass zclass, const Name& zname) {
+ stringstream ss("ns.example.com. 3600 IN A 192.0.2.7");
+ return (createSQLite3Client(zclass, zname, ss));
+}
+
// The test class. Its parameterized so we can share the test scnearios
// for any concrete data source implementaitons.
class ZoneFinderContextTest :
@@ -134,7 +139,7 @@ protected:
// We test the in-memory and SQLite3 data source implementations.
INSTANTIATE_TEST_CASE_P(, ZoneFinderContextTest,
::testing::Values(createInMemoryClient,
- createSQLite3Client));
+ createSQLite3ClientWithNS));
TEST_P(ZoneFinderContextTest, getAdditionalAuthNS) {
ZoneFinderContextPtr ctx = finder_->find(qzone_, RRType::NS());
@@ -430,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);
+}
+
}
More information about the bind10-changes
mailing list