|
@@ -224,15 +224,10 @@ private:
|
|
|
// after the RR class below.
|
|
|
}
|
|
|
|
|
|
- const MaybeRRClass rrclass =
|
|
|
- RRClass::createFromText(rrparam_token.getString());
|
|
|
+ boost::scoped_ptr<RRClass> rrclass
|
|
|
+ (RRClass::createFromText(rrparam_token.getString()));
|
|
|
if (rrclass) {
|
|
|
- // FIXME: The following code re-parses the rrparam_token to
|
|
|
- // make an RRClass instead of using the MaybeRRClass above,
|
|
|
- // because some old versions of boost::optional (that we
|
|
|
- // still want to support) have a bug (see trac #2593). This
|
|
|
- // workaround should be removed at some point in the future.
|
|
|
- if (RRClass(rrparam_token.getString()) != zone_class_) {
|
|
|
+ if (*rrclass != zone_class_) {
|
|
|
isc_throw(InternalException, "Class mismatch: " << *rrclass <<
|
|
|
" vs. " << zone_class_);
|
|
|
}
|
|
@@ -280,11 +275,7 @@ private:
|
|
|
// care about where it comes from). see LimitTTL() for parameter
|
|
|
// post_parsing.
|
|
|
void setDefaultTTL(const RRTTL& ttl, bool post_parsing) {
|
|
|
- if (!default_ttl_) {
|
|
|
- default_ttl_.reset(new RRTTL(ttl));
|
|
|
- } else {
|
|
|
- *default_ttl_ = ttl;
|
|
|
- }
|
|
|
+ assignTTL(default_ttl_, ttl);
|
|
|
limitTTL(*default_ttl_, post_parsing);
|
|
|
}
|
|
|
|
|
@@ -296,9 +287,9 @@ private:
|
|
|
// We use the factory version instead of RRTTL constructor as we
|
|
|
// need to expect cases where ttl_txt does not actually represent a TTL
|
|
|
// but an RR class or type.
|
|
|
- const MaybeRRTTL maybe_ttl = RRTTL::createFromText(ttl_txt);
|
|
|
- if (maybe_ttl) {
|
|
|
- current_ttl_ = maybe_ttl;
|
|
|
+ RRTTL* rrttl = RRTTL::createFromText(ttl_txt);
|
|
|
+ if (rrttl) {
|
|
|
+ current_ttl_.reset(rrttl);
|
|
|
limitTTL(*current_ttl_, false);
|
|
|
return (true);
|
|
|
}
|
|
@@ -329,7 +320,7 @@ private:
|
|
|
dynamic_cast<const rdata::generic::SOA&>(*rdata).
|
|
|
getMinimum();
|
|
|
setDefaultTTL(RRTTL(ttl_val), true);
|
|
|
- current_ttl_ = *default_ttl_;
|
|
|
+ assignTTL(current_ttl_, *default_ttl_);
|
|
|
} else {
|
|
|
// On catching the exception we'll try to reach EOL again,
|
|
|
// so we need to unget it now.
|
|
@@ -338,7 +329,7 @@ private:
|
|
|
"no TTL specified; load rejected");
|
|
|
}
|
|
|
} else if (!explicit_ttl && default_ttl_) {
|
|
|
- current_ttl_ = *default_ttl_;
|
|
|
+ assignTTL(current_ttl_, *default_ttl_);
|
|
|
} else if (!explicit_ttl && warn_rfc1035_ttl_) {
|
|
|
// Omitted (class and) TTL values are default to the last
|
|
|
// explicitly stated values (RFC 1035, Sec. 5.1).
|
|
@@ -395,6 +386,17 @@ private:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /// \brief Assign the right RRTTL's value to the left RRTTL. If one
|
|
|
+ /// doesn't exist in the scoped_ptr, make a new RRTTL copy of the
|
|
|
+ /// right argument.
|
|
|
+ static void assignTTL(boost::scoped_ptr<RRTTL>& left, const RRTTL& right) {
|
|
|
+ if (!left) {
|
|
|
+ left.reset(new RRTTL(right));
|
|
|
+ } else {
|
|
|
+ *left = right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private:
|
|
|
MasterLexer lexer_;
|
|
|
const Name zone_origin_;
|
|
@@ -407,8 +409,10 @@ private:
|
|
|
boost::scoped_ptr<RRTTL> default_ttl_; // Default TTL of RRs used when
|
|
|
// unspecified. If NULL no default
|
|
|
// is known.
|
|
|
- MaybeRRTTL current_ttl_; // The TTL used most recently. Initially unset.
|
|
|
- // Once set always stores a valid RRTTL.
|
|
|
+ boost::scoped_ptr<RRTTL> current_ttl_; // The TTL used most recently.
|
|
|
+ // Initially unset. Once set
|
|
|
+ // always stores a valid
|
|
|
+ // RRTTL.
|
|
|
const MasterLoader::Options options_;
|
|
|
const std::string master_file_;
|
|
|
std::string string_token_;
|