BIND 10 trac2383, updated. b2d9be92c95432c92d4996bd999960e08edcc9bc [2383] Check origin is provided when needed

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Oct 30 11:28:48 UTC 2012


The branch, trac2383 has been updated
       via  b2d9be92c95432c92d4996bd999960e08edcc9bc (commit)
      from  0be210a2f53811e07a7ff0aad0aa388c3ef6048c (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 b2d9be92c95432c92d4996bd999960e08edcc9bc
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Tue Oct 30 12:28:13 2012 +0100

    [2383] Check origin is provided when needed
    
    When the name passed in the string is relative, we need to have the
    origin to complete the name with.

-----------------------------------------------------------------------

Summary of changes:
 src/lib/dns/name.cc |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

-----------------------------------------------------------------------
diff --git a/src/lib/dns/name.cc b/src/lib/dns/name.cc
index 733b52b..6e6a704 100644
--- a/src/lib/dns/name.cc
+++ b/src/lib/dns/name.cc
@@ -321,12 +321,22 @@ Name::Name(const std::string &namestring, bool downcase) {
     offsets_.assign(offsets.begin(), offsets.end());
 }
 
-Name::Name(const char* namedata, size_t data_len, const Name*, bool downcase) {
+Name::Name(const char* namedata, size_t data_len, const Name* origin,
+           bool downcase)
+{
     // Check validity of data
     if (namedata == NULL || data_len == 0) {
         isc_throw(isc::InvalidParameter,
                   "No data provided to Name constructor");
     }
+    // If the last character is not a dot, it is a relative to origin.
+    // It is safe to check now, we know there's at least one character.
+    const bool absolute = (namedata[data_len - 1] == '.');
+    // If we are not absolute, we need the origin to complete the name.
+    if (!absolute && origin == NULL) {
+        isc_throw(MissingNameOrigin,
+                  "No origin available and name is relative");
+    }
     // Prepare inputs for the parser
     const char* end = namedata + data_len;
 



More information about the bind10-changes mailing list