From 47f1415387f974e7ccdf7d95d7a380827486bc22 Mon Sep 17 00:00:00 2001 From: JINMEI Tatuya Date: Tue, 17 Apr 2012 17:52:18 -0700 Subject: [PATCH] [1891] reject attempt of deleting NSEC3 before start transaction. --- src/lib/datasrc/sqlite3_accessor.cc | 6 ++++-- src/lib/datasrc/tests/sqlite3_accessor_unittest.cc | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc index d606672da2..ef1562a1d9 100644 --- a/src/lib/datasrc/sqlite3_accessor.cc +++ b/src/lib/datasrc/sqlite3_accessor.cc @@ -1197,8 +1197,10 @@ void SQLite3Accessor::deleteNSEC3RecordInZone( const string (¶ms)[DEL_PARAM_COUNT]) { - // TBD: no transaction check - + if (!dbparameters_->updating_zone) { + isc_throw(DataSourceError, "deleting NSEC3-related record in SQLite3 " + "data source without transaction"); + } doUpdate( *dbparameters_, DEL_NSEC3_RECORD, params, "delete NSEC3 record from zone"); diff --git a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc index 23c3e54cca..bde3e0f02d 100644 --- a/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc +++ b/src/lib/datasrc/tests/sqlite3_accessor_unittest.cc @@ -1180,6 +1180,10 @@ TEST_F(SQLite3Update, deleteNonexistent) { TEST_F(SQLite3Update, invalidDelete) { // An attempt of delete before an explicit start of transaction EXPECT_THROW(accessor->deleteRecordInZone(del_params), DataSourceError); + + // Same for NSEC3. + EXPECT_THROW(accessor->deleteNSEC3RecordInZone(del_params), + DataSourceError); } TEST_F(SQLite3Update, emptyTransaction) {