Browse Source

[trac526] Implement returning CNAME

No chaining is implemented. While RFC 1024 indicates we should do it at
last inside the same zone, we don't now and leave it out for later.

The CNAME is handled in the same way as as SUCCESS with slight
modification about additional data (which probably never happen in real
life anyway).
Michal 'vorner' Vaner 14 years ago
parent
commit
94b0beeb60
1 changed files with 11 additions and 1 deletions
  1. 11 1
      src/bin/auth/query.cc

+ 11 - 1
src/bin/auth/query.cc

@@ -143,6 +143,16 @@ Query::process() const {
         keep_doing = false;
         Zone::FindResult db_result = result.zone->find(qname_, qtype_);
         switch (db_result.code) {
+            case Zone::CNAME:
+                /*
+                 * We don't do chaining yet. Therefore handling a CNAME is
+                 * mostly the same as handling SUCCESS, but we didn't get
+                 * what we expected. It means no exceptions in ANY or NS
+                 * on the origin (though CNAME in origin is probably
+                 * forbidden anyway).
+                 *
+                 */
+                // No break; here, fall trough.
             case Zone::SUCCESS:
                 response_.setRcode(Rcode::NOERROR());
                 response_.addRRset(Message::SECTION_ANSWER,
@@ -154,6 +164,7 @@ Query::process() const {
                 // and AAAA/A RRS of each of the NS RDATA into the additional
                 // section.
                 if (qname_ != result.zone->getOrigin() ||
+                    db_result.code != Zone::SUCCESS ||
                     (qtype_ != RRType::NS() && qtype_ != RRType::ANY()))
                 {
                     getAuthAdditional(*result.zone);
@@ -176,7 +187,6 @@ Query::process() const {
                 response_.setRcode(Rcode::NOERROR());
                 putSOA(*result.zone);
                 break;
-            case Zone::CNAME:
             case Zone::DNAME:
                 // TODO : replace qname, continue lookup
                 break;