]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[2377] Handle relative names
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Dec 2012 12:42:17 +0000 (13:42 +0100)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Dec 2012 12:42:17 +0000 (13:42 +0100)
Tested at least on the domain names. There is no known Rdata type
implementation handling relative names right now.

src/lib/dns/master_loader.cc
src/lib/dns/tests/testdata/example.org

index 6c837e851193f7ba3acd9db23b24ed1a4bcd00ba..5a5aa13e2e002ed70518c424fec416dffe238989 100644 (file)
@@ -77,9 +77,11 @@ public:
             // Return the last token, as it was not empty
             lexer_.ungetToken();
 
-            const string name_string(getString());
+            const MasterToken::StringRegion
+                name_string(lexer_.getNextToken(MasterToken::QSTRING).
+                            getStringRegion());
             // TODO $ handling
-            const Name name(name_string); // TODO: Origin
+            const Name name(name_string.beg, name_string.len, &zone_origin_);
             // TODO: Some more flexibility. We don't allow omitting anything yet
 
             // The parameters
@@ -87,9 +89,9 @@ public:
             const RRClass rrclass(getString());
             const RRType rrtype(getString());
 
-            // TODO: Origin handling
             const rdata::RdataPtr data(rdata::createRdata(rrtype, rrclass,
-                                                          lexer_, NULL,
+                                                          lexer_,
+                                                          &zone_origin_,
                                                           options_,
                                                           callbacks_));
             // In case we get NULL, it means there was error creating
@@ -108,7 +110,7 @@ public:
 
 private:
     MasterLexer lexer_;
-    const Name& zone_origin_;
+    const Name zone_origin_;
     const RRClass zone_class_;
     MasterLoaderCallbacks callbacks_;
     AddRRCallback add_callback_;
index 65a6d0e9159210d2e45bbb665db513f1b028ad79..deef7d58f58f3fdcc70683fab595713e0d09d6f3 100644 (file)
@@ -11,4 +11,4 @@ example.org.        3600    IN  NS ns1.example.org.
 
 
 ; Some empty lines here. They are to make sure the loader can skip them.
-www.example.org.    3600    IN  A 192.0.2.1
+www                 3600    IN  A 192.0.2.1 ; Test a relative name as well.