mirror of
https://github.com/ZeusWPI/ZNS.git
synced 2024-11-21 21:41:10 +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> {
|
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();
|
let zlen = question.qname.len();
|
||||||
zlen >= auth_zone.len()
|
if !(zlen >= auth_zone.len()
|
||||||
&& vec_equal(&question.qname[zlen - auth_zone.len()..], auth_zone)
|
&& vec_equal(&question.qname[zlen - auth_zone.len()..], auth_zone))
|
||||||
});
|
{
|
||||||
|
return Err(ZNSError::Refused {
|
||||||
if !authoritative {
|
message: format!("Not authoritative for: {}", question.qname.join(".")),
|
||||||
return Err(ZNSError::Refused {
|
});
|
||||||
message: "Not authoritative".to_string(),
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue