From: Mukund Sivaraman Date: Tue, 18 Dec 2012 09:26:33 +0000 (+0530) Subject: Merge branch 'master' into trac2431_2 X-Git-Tag: bind10-1.0.0-beta-release~13^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5cd3fa2a026c0cfadffe57b6c859f8621c17c21f;p=thirdparty%2Fkea.git Merge branch 'master' into trac2431_2 Conflicts: src/lib/dns/master_loader.cc --- 5cd3fa2a026c0cfadffe57b6c859f8621c17c21f diff --cc src/lib/dns/master_loader.cc index c3ee412da5,6190c7a5c7..5ee09f59f3 --- a/src/lib/dns/master_loader.cc +++ b/src/lib/dns/master_loader.cc @@@ -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. + // + // [] [] + // [] [] + 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; + 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