Browse Source

[1577] Validate the findNSEC3 input

We check the name comes from inside the zone.
Michal 'vorner' Vaner 13 years ago
parent
commit
7ef140c77f
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/lib/datasrc/database.cc

+ 11 - 1
src/lib/datasrc/database.cc

@@ -911,7 +911,17 @@ DatabaseClient::Finder::findInternal(const Name& name, const RRType& type,
 }
 
 ZoneFinder::FindNSEC3Result
-DatabaseClient::Finder::findNSEC3(const Name&, bool) {
+DatabaseClient::Finder::findNSEC3(const Name& name, bool) {
+    // TODO: Some logging.
+
+    // First, validate the input
+    const NameComparisonResult cmp_result(name.compare(getOrigin()));
+    if (cmp_result.getRelation() != NameComparisonResult::EQUAL &&
+        cmp_result.getRelation() != NameComparisonResult::SUBDOMAIN) {
+        isc_throw(OutOfZone, "findNSEC3 attempt for out-of-zone name: " <<
+                  name << ", zone: " << getOrigin() << "/" << getClass());
+    }
+
     isc_throw(NotImplemented, "findNSEC3 is not yet implemented for database "
               "data source");
 }