-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require single class zonefiles by default, and give context if possible on parsing errors. #477
base: main
Are you sure you want to change the base?
Require single class zonefiles by default, and give context if possible on parsing errors. #477
Conversation
…ection 5.2 requirement that a zonefile consist of exactly one class, enabled by default, and extend its error reporting to say what the wrong and expected classes were (and also use this contextual error support for other errors where applicable).
…uses some existing tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good @ximon18!
#[cfg(not(feature = "std"))] | ||
{ | ||
f.write_str(self.msg) | ||
} | ||
|
||
#[cfg(feature = "std")] | ||
{ | ||
if let Some(context) = &self.context { | ||
f.write_fmt(format_args!("{}: {}", self.msg, context)) | ||
} else { | ||
f.write_str(self.msg) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be more concise if you write out the message unconditionally:
f.write_str(self.msg)?;
#[cfg(feature = "std")]
if let Some(context) = &self.context {
write!(f, ": {}", context)?;
}
|
||
(None, Some(last_class)) => last_class, | ||
|
||
(None, None) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not correct. There is no default class according to RFC 1035. Do other parsers accept leaving out the class entirely?
Extend the inplace zone parser to detect violations of the RFC 1035 section 5.2 requirement that a zonefile consist of exactly one class, enabled by default, and extend its error reporting to say what the wrong and expected classes were (and also use this contextual error support for other errors where applicable).
This is a breaking change as it enables the validation checks by default.