mirror of
https://github.com/ZeusWPI/ZNS.git
synced 2024-10-29 21:14:27 +01:00
put invalid question name in error
This commit is contained in:
parent
4261d06248
commit
60ea5f109e
1 changed files with 8 additions and 10 deletions
|
@ -20,18 +20,16 @@ impl Message {
|
|||
}
|
||||
|
||||
pub fn check_authoritative(&self, auth_zone: &LabelString) -> Result<(), ZNSError> {
|
||||
let authoritative = self.question.iter().all(|question| {
|
||||
for question in &self.question {
|
||||
let zlen = question.qname.len();
|
||||
zlen >= auth_zone.len()
|
||||
&& vec_equal(&question.qname[zlen - auth_zone.len()..], auth_zone)
|
||||
});
|
||||
|
||||
if !authoritative {
|
||||
if !(zlen >= auth_zone.len()
|
||||
&& vec_equal(&question.qname[zlen - auth_zone.len()..], auth_zone))
|
||||
{
|
||||
return Err(ZNSError::Refused {
|
||||
message: "Not authoritative".to_string(),
|
||||
message: format!("Not authoritative for: {}", question.qname.join(".")),
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue