]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
Merge branch 'master' into trac2431_2
authorMukund Sivaraman <muks@isc.org>
Tue, 18 Dec 2012 09:26:33 +0000 (14:56 +0530)
committerMukund Sivaraman <muks@isc.org>
Tue, 18 Dec 2012 09:26:33 +0000 (14:56 +0530)
Conflicts:
src/lib/dns/master_loader.cc

1  2 
src/lib/dns/master_loader.cc
src/lib/dns/tests/master_loader_unittest.cc

index c3ee412da583ac25ab52fcc0785377a3578412ff,6190c7a5c7085abe6381371b740b769196e0ddbd..5ee09f59f3f14888f620981f741ebc3618cac693
@@@ -143,59 -143,9 +143,59 @@@ private
          pushSource(filename);
      }
  
 +    // A helper method for loadIncremental(). It parses part of an RR
 +    // until it finds the RR type field.  If TTL or RR class is
 +    // specified before the RR type, it also recognizes and validates
 +    // them.  explicit_ttl will be set to true if this method finds a
 +    // valid TTL field.
 +    RRType parseRRParams(bool& explicit_ttl) {
 +        // Find TTL, class and type.  Both TTL and class are
 +        // optional and may occur in any order if they exist. TTL
 +        // and class come before type which must exist.
 +        //
 +        // [<TTL>] [<class>] <type> <RDATA>
 +        // [<class>] [<TTL>] <type> <RDATA>
 +        MasterToken rrparam_token = lexer_.getNextToken(MasterToken::STRING);
 +
 +        // named-signzone outputs TTL first, so try parsing it in order
 +        // first.
 +        if (setCurrentTTL(rrparam_token.getString())) {
 +            explicit_ttl = true;
 +            rrparam_token = lexer_.getNextToken(MasterToken::STRING);
 +        } else {
 +            // If it's not a TTL here, continue and try again
 +            // after the RR class below.
 +        }
 +
 +        boost::scoped_ptr<RRClass> rrclass;
 +        try {
 +            rrclass.reset(new RRClass(rrparam_token.getString()));
 +            rrparam_token = lexer_.getNextToken(MasterToken::STRING);
 +        } catch (const InvalidRRClass&) {
 +            // If it's not an rrclass here, use the zone's class.
 +            rrclass.reset(new RRClass(zone_class_));
 +        }
 +
 +        // If we couldn't parse TTL earlier in the stream (above), try
 +        // again at current location.
 +        if (!explicit_ttl &&
 +            setCurrentTTL(rrparam_token.getString())) {
 +            explicit_ttl = true;
 +            rrparam_token = lexer_.getNextToken(MasterToken::STRING);
 +        }
 +
 +        if (*rrclass != zone_class_) {
 +            isc_throw(InternalException, "Class mismatch: " << *rrclass <<
 +                      "vs. " << zone_class_);
 +        }
 +
 +        // Return the current string token's value as the RRType.
 +        return (RRType(rrparam_token.getString()));
 +    }
 +
      // Upper limit check when recognizing a specific TTL value from the
      // zone file ($TTL, the RR's TTL field, or the SOA minimum).  RFC2181
-     // Section 8 limits the range of TTL values to unsigned 32-bit integers,
+     // Section 8 limits the range of TTL values to 2^31-1 (0x7fffffff),
      // and prohibits transmitting a TTL field exceeding this range.  We
      // guarantee that by limiting the value at the time of zone
      // parsing/loading, following what BIND 9 does.  Resetting it to 0