fix panic on name too long

This commit is contained in:
Benjamin Fry 2021-04-10 16:05:02 -07:00
parent 7c2567daa7
commit 6dfc6713fa
7 changed files with 127 additions and 89 deletions

View File

@ -13,13 +13,17 @@ All notes should be prepended with the location of the change, e.g. `(proto)` or
- (resolver) DnsRequestOptions and ResolverOpts now `#[non_exaustive]` #1426
- (proto) all I/O Streams now use `BufDnsStreamHandle` rather than generic `DnsStreamHandle` #1433
- (proto) `DnsResponse` response now contains only a single Response #1433
- (proto) `Name::append_name` and `Name::append_domain` now properly fallible when name is too long #1448
### Removed
- (proto) removed `BufStreamHandle` and `StreamHandle` #1433
- (response) disabled `mdns` to work on a new solution #1433
### Fixed
- (proto) Panic when name exceeds maximal domain name length during display #1447
## 0.20.1
### Added

View File

@ -27,45 +27,45 @@ use radix_trie::{Trie, TrieKey};
// ```
lazy_static! {
/// 10.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_10: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("10").unwrap().append_domain(&*IN_ADDR_ARPA));
pub static ref IN_ADDR_ARPA_10: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("10").unwrap().append_domain(&*IN_ADDR_ARPA).unwrap());
static ref IN_ADDR_ARPA_172: Name = Name::from_ascii("172").unwrap().append_domain(&*IN_ADDR_ARPA);
static ref IN_ADDR_ARPA_172: Name = Name::from_ascii("172").unwrap().append_domain(&*IN_ADDR_ARPA).unwrap();
/// 16.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_16: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("16").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_16: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("16").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 17.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_17: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("17").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_17: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("17").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 18.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_18: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("18").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_18: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("18").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 19.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_19: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("19").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_19: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("19").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 20.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_20: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("20").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_20: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("20").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 21.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_21: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("21").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_21: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("21").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 22.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_22: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("22").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_22: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("22").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 23.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_23: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("23").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_23: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("23").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 24.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_24: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("24").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_24: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("24").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 25.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_25: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("25").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_25: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("25").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 26.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_26: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("26").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_26: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("26").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 27.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_27: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("27").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_27: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("27").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 28.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_28: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("28").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_28: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("28").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 29.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_29: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("29").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_29: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("29").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 30.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_30: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("30").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_30: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("30").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 31.172.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_172_31: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("31").unwrap().append_domain(&*IN_ADDR_ARPA_172));
pub static ref IN_ADDR_ARPA_172_31: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("31").unwrap().append_domain(&*IN_ADDR_ARPA_172).unwrap());
/// 168.192.in-addr.arpa. usage
pub static ref IN_ADDR_ARPA_192_168: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("168.192").unwrap().append_domain(&*IN_ADDR_ARPA));
pub static ref IN_ADDR_ARPA_192_168: ZoneUsage = ZoneUsage::reverse(Name::from_ascii("168.192").unwrap().append_domain(&*IN_ADDR_ARPA).unwrap());
}
// example., example.com., example.net., and example.org.

View File

@ -103,11 +103,7 @@ pub fn rrset_tbs(
// put records in canonical order
rrset.sort();
let name: Name = if let Some(name) = determine_name(name, num_labels) {
name
} else {
return Err(format!("could not determine name from {}", name).into());
};
let name = determine_name(name, num_labels)?;
// TODO: rather than buffering here, use the Signer/Verifier? might mean fewer allocations...
let mut buf: Vec<u8> = Vec::new();
@ -254,7 +250,7 @@ pub fn rrset_tbs_with_sig(
///
/// The canonical forms for names and RRsets are defined in [RFC4034].
/// ```
pub fn determine_name(name: &Name, num_labels: u8) -> Option<Name> {
pub fn determine_name(name: &Name, num_labels: u8) -> Result<Name, ProtoError> {
// To calculate the name:
// let rrsig_labels = the value of the RRSIG Labels field
//
@ -267,7 +263,7 @@ pub fn determine_name(name: &Name, num_labels: u8) -> Option<Name> {
// name = fqdn
if fqdn_labels == num_labels {
return Some(name.clone());
return Ok(name.clone());
}
// if rrsig_labels < fqdn_labels,
// name = "*." | the rightmost rrsig_label labels of the
@ -276,10 +272,10 @@ pub fn determine_name(name: &Name, num_labels: u8) -> Option<Name> {
let mut star_name: Name = Name::from_labels(vec![b"*" as &[u8]]).unwrap();
let rightmost = name.trim_to(num_labels as usize);
if !rightmost.is_root() {
star_name = star_name.append_name(&rightmost);
return Some(star_name);
star_name = star_name.append_name(&rightmost)?;
return Ok(star_name);
}
return Some(star_name);
return Ok(star_name);
}
//
// if rrsig_labels > fqdn_labels
@ -287,6 +283,5 @@ pub fn determine_name(name: &Name, num_labels: u8) -> Option<Name> {
// checks and MUST NOT be used to authenticate this
// RRset.
// TODO: this should be an error
None
Err(format!("could not determine name from {}", name).into())
}

View File

@ -46,6 +46,16 @@ impl Name {
this
}
/// Extend the name with the offered label, and ensure maximum name length is not exceeded.
fn extend_name(&mut self, label: &[u8]) -> Result<(), ProtoError> {
self.label_data.extend_from_slice(label);
self.label_ends.push(self.label_data.len() as u8);
if self.len() > 255 {
return Err("labels exceed maximum length of 255".into());
};
Ok(())
}
/// Returns true if there are no labels, i.e. it's empty.
///
/// In DNS the root is represented by `.`
@ -118,12 +128,7 @@ impl Name {
/// assert_eq!(name, Name::from_str("www.example.com").unwrap());
/// ```
pub fn append_label<L: IntoLabel>(mut self, label: L) -> ProtoResult<Self> {
self.label_data
.extend_from_slice(label.into_label()?.as_bytes());
self.label_ends.push(self.label_data.len() as u8);
if self.len() > 255 {
return Err("labels exceed maximum length of 255".into());
};
self.extend_name(label.into_label()?.as_bytes())?;
Ok(self)
}
@ -194,25 +199,24 @@ impl Name {
/// let domain = Name::from_str("example.com").unwrap();
/// assert!(!domain.is_fqdn());
///
/// let name = local.clone().append_name(&domain);
/// let name = local.clone().append_name(&domain).unwrap();
/// assert_eq!(name, Name::from_str("www.example.com").unwrap());
/// assert!(!name.is_fqdn());
///
/// // see also `Name::append_domain`
/// let domain = Name::from_str("example.com.").unwrap();
/// assert!(domain.is_fqdn());
/// let name = local.append_name(&domain);
/// let name = local.append_name(&domain).unwrap();
/// assert_eq!(name, Name::from_str("www.example.com.").unwrap());
/// assert!(name.is_fqdn());
/// ```
pub fn append_name(mut self, other: &Self) -> Self {
pub fn append_name(mut self, other: &Self) -> Result<Self, ProtoError> {
for label in other.iter() {
self.label_data.extend_from_slice(label);
self.label_ends.push(self.label_data.len() as u8);
self.extend_name(label)?;
}
self.is_fqdn = other.is_fqdn;
self
Ok(self)
}
/// Appends the `domain` to `self`, making the new `Name` an FQDN
@ -228,14 +232,14 @@ impl Name {
///
/// let local = Name::from_str("www").unwrap();
/// let domain = Name::from_str("example.com").unwrap();
/// let name = local.append_domain(&domain);
/// let name = local.append_domain(&domain).unwrap();
/// assert_eq!(name, Name::from_str("www.example.com").unwrap());
/// assert!(name.is_fqdn())
/// ```
pub fn append_domain(self, domain: &Self) -> Self {
let mut this = self.append_name(domain);
pub fn append_domain(self, domain: &Self) -> Result<Self, ProtoError> {
let mut this = self.append_name(domain)?;
this.set_fqdn(true);
this
Ok(this)
}
/// Creates a new Name with all labels lowercased
@ -585,7 +589,7 @@ impl Name {
if local.ends_with('.') {
name.set_fqdn(true);
} else if let Some(other) = origin {
return Ok(name.append_domain(other));
return name.append_domain(other);
}
Ok(name)
@ -878,6 +882,8 @@ impl Name {
label_data.push(b'*');
let mut label_ends = TinyVec::new();
label_ends.push(1);
// this is not using the Name::extend_name function as it should always be shorter than the original name, so length check is unnecessary
for label in self.iter().skip(1) {
label_data.extend_from_slice(label);
label_ends.push(label_data.len() as u8);
@ -1108,21 +1114,16 @@ impl<'r> BinDecodable<'r> for Name {
/// all names will be stored lowercase internally.
/// This will consume the portions of the `Vec` which it is reading...
fn read(decoder: &mut BinDecoder<'r>) -> ProtoResult<Name> {
let mut label_data = TinyVec::new();
let mut label_ends = TinyVec::new();
read_inner(decoder, &mut label_data, &mut label_ends, None)?;
Ok(Name {
is_fqdn: true,
label_data,
label_ends,
})
let mut name = Name::root(); // this is FQDN
read_inner(decoder, &mut name, None)?;
Ok(name)
}
}
fn read_inner(
decoder: &mut BinDecoder<'_>,
label_data: &mut TinyVec<[u8; 32]>,
label_ends: &mut TinyVec<[u8; 24]>,
name: &mut Name,
max_idx: Option<usize>,
) -> Result<(), DecodeError> {
let mut state: LabelParseState = LabelParseState::LabelLengthOrPointer;
@ -1144,12 +1145,6 @@ fn read_inner(
}
}
// enforce max length of name
let cur_len = label_data.len() + label_ends.len();
if cur_len > 255 {
return Err(DecodeError::DomainNameTooLong(cur_len));
}
state = match state {
LabelParseState::LabelLengthOrPointer => {
// determine what the next label is
@ -1170,8 +1165,8 @@ fn read_inner(
.verify_unwrap(|l| l.len() <= 63)
.map_err(|l| DecodeError::LabelBytesTooLong(l.len()))?;
label_data.extend_from_slice(label);
label_ends.push(label_data.len() as u8);
name.extend_name(label)
.map_err(|_| DecodeError::DomainNameTooLong(label.len()))?;
// reset to collect more data
LabelParseState::LabelLengthOrPointer
@ -1215,7 +1210,7 @@ fn read_inner(
})?;
let mut pointer = decoder.clone(location);
read_inner(&mut pointer, label_data, label_ends, Some(name_start))?;
read_inner(&mut pointer, name, Some(name_start))?;
// Pointers always finish the name, break like Root.
break;
@ -1891,4 +1886,21 @@ mod tests {
)
);
}
#[test]
fn test_name_too_long_with_append() {
// from https://github.com/bluejekyll/trust-dns/issues/1447
let n = Name::from_ascii("Llocainvannnnnnaxgtezqzqznnnnnn1na.nnntnninvannnnnnaxgtezqzqznnnnnn1na.nnntnnnnnnnaxgtezqzqznnnnnn1na.nnntnaaaaaaaaaaaaaaaaaaaaaaaaiK.iaaaaaaaaaaaaaaaaaaaaaaaaiKa.innnnnaxgtezqzqznnnnnn1na.nnntnaaaaaaaaaaaaaaaaaaaaaaaaiK.iaaaaaaaaaaaaaaaaaaaaaaaaiKa.in").unwrap();
let sfx = Name::from_ascii("xxxxxxx.yyyyy.zzz").unwrap();
let error = n
.append_domain(&sfx)
.err()
.expect("should have errored, too long");
match error.kind() {
ProtoErrorKind::Message("labels exceed maximum length of 255") => (),
_ => panic!("expected too long message"),
}
}
}

View File

@ -23,9 +23,9 @@ lazy_static! {
lazy_static! {
static ref ARPA: Name = Name::from_ascii("arpa.").unwrap();
/// zone for ipv4 reverse addresses
pub static ref IN_ADDR_ARPA: Name = Name::from_ascii("in-addr").unwrap().append_domain(&*ARPA);
pub static ref IN_ADDR_ARPA: Name = Name::from_ascii("in-addr").unwrap().append_domain(&*ARPA).unwrap();
/// zone for ipv6 reverse addresses
pub static ref IP6_ARPA: Name = Name::from_ascii("ip6").unwrap().append_domain(&*ARPA);
pub static ref IP6_ARPA: Name = Name::from_ascii("ip6").unwrap().append_domain(&*ARPA).unwrap();
}
lazy_static! {
@ -44,10 +44,10 @@ lazy_static! {
pub static ref LOCALHOST: ZoneUsage = ZoneUsage::localhost(Name::from_ascii("localhost.").unwrap());
/// 127.in-addr.arpa. usage; 127/8 is reserved for loopback
pub static ref IN_ADDR_ARPA_127: ZoneUsage = ZoneUsage::localhost(Name::from_ascii("127").unwrap().append_domain(&*IN_ADDR_ARPA));
pub static ref IN_ADDR_ARPA_127: ZoneUsage = ZoneUsage::localhost(Name::from_ascii("127").unwrap().append_domain(&*IN_ADDR_ARPA).unwrap());
/// 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa. usage; 1/128 is the only address in ipv6 loopback
pub static ref IP6_ARPA_1: ZoneUsage = ZoneUsage::localhost(Name::from_ascii("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0").unwrap().append_domain(&*IP6_ARPA));
pub static ref IP6_ARPA_1: ZoneUsage = ZoneUsage::localhost(Name::from_ascii("1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0").unwrap().append_domain(&*IP6_ARPA).unwrap());
}
lazy_static! {
@ -84,14 +84,14 @@ lazy_static! {
// the mDNS IPv4 link-local multicast address 224.0.0.251.
/// 254.169.in-addr.arpa. usage link-local, i.e. mDNS
pub static ref IN_ADDR_ARPA_169_254: ZoneUsage = ZoneUsage::local(Name::from_ascii("254.169").unwrap().append_domain(&*IN_ADDR_ARPA));
pub static ref IN_ADDR_ARPA_169_254: ZoneUsage = ZoneUsage::local(Name::from_ascii("254.169").unwrap().append_domain(&*IN_ADDR_ARPA).unwrap());
/// 254.169.in-addr.arpa. usage link-local, i.e. mDNS
pub static ref IP6_ARPA_FE_8: ZoneUsage = ZoneUsage::local(Name::from_ascii("8.e.f").unwrap().append_domain(&*IP6_ARPA));
pub static ref IP6_ARPA_FE_8: ZoneUsage = ZoneUsage::local(Name::from_ascii("8.e.f").unwrap().append_domain(&*IP6_ARPA).unwrap());
/// 254.169.in-addr.arpa. usage link-local, i.e. mDNS
pub static ref IP6_ARPA_FE_9: ZoneUsage = ZoneUsage::local(Name::from_ascii("9.e.f").unwrap().append_domain(&*IP6_ARPA));
pub static ref IP6_ARPA_FE_9: ZoneUsage = ZoneUsage::local(Name::from_ascii("9.e.f").unwrap().append_domain(&*IP6_ARPA).unwrap());
/// 254.169.in-addr.arpa. usage link-local, i.e. mDNS
pub static ref IP6_ARPA_FE_B: ZoneUsage = ZoneUsage::local(Name::from_ascii("b.e.f").unwrap().append_domain(&*IP6_ARPA));
pub static ref IP6_ARPA_FE_B: ZoneUsage = ZoneUsage::local(Name::from_ascii("b.e.f").unwrap().append_domain(&*IP6_ARPA).unwrap());
}
lazy_static! {

View File

@ -317,12 +317,26 @@ impl<C: DnsHandle<Error = ResolveError>, P: ConnectionProvider<Conn = C>> AsyncR
for search in self.config.search().iter().rev() {
let name_search = name.clone().append_domain(search);
Self::push_name(name_search, &mut names);
match name_search {
Ok(name_search) => Self::push_name(name_search, &mut names),
Err(e) => debug!(
"Not adding {} to {} for search due to error: {}",
search, name, e
),
}
}
if let Some(domain) = self.config.domain() {
let name_search = name.clone().append_domain(domain);
Self::push_name(name_search, &mut names);
match name_search {
Ok(name_search) => Self::push_name(name_search, &mut names),
Err(e) => debug!(
"Not adding {} to {} for search due to error: {}",
domain, name, e
),
}
}
// this is the direct name lookup

View File

@ -32,7 +32,9 @@ pub fn test_create<A: Authority<Lookup = AuthLookup>>(mut authority: A, keys: &[
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
let record = Record::from_rdata(name.clone(), 8, RData::A(Ipv4Addr::new(127, 0, 0, 10)));
let message = update_message::create(
record.clone().into(),
@ -69,7 +71,8 @@ pub fn test_create_multi<A: Authority<Lookup = AuthLookup>>(mut authority: A, ke
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// create a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
record.set_rdata(RData::A(Ipv4Addr::new(100, 10, 100, 10)));
@ -108,7 +111,8 @@ pub fn test_append<A: Authority<Lookup = AuthLookup>>(mut authority: A, keys: &[
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
@ -185,7 +189,8 @@ pub fn test_append_multi<A: Authority<Lookup = AuthLookup>>(mut authority: A, ke
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
@ -246,7 +251,8 @@ pub fn test_compare_and_swap<A: Authority<Lookup = AuthLookup>>(mut authority: A
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// create a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
@ -312,7 +318,8 @@ pub fn test_compare_and_swap_multi<A: Authority<Lookup = AuthLookup>>(
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// create a record
let mut current = RecordSet::with_ttl(name.clone(), RecordType::A, 8);
@ -386,7 +393,8 @@ pub fn test_delete_by_rdata<A: Authority<Lookup = AuthLookup>>(mut authority: A,
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut record1 = Record::with(name.clone(), RecordType::A, 8);
@ -439,7 +447,9 @@ pub fn test_delete_by_rdata_multi<A: Authority<Lookup = AuthLookup>>(
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut rrset = RecordSet::with_ttl(name.clone(), RecordType::A, 8);
@ -500,7 +510,8 @@ pub fn test_delete_rrset<A: Authority<Lookup = AuthLookup>>(mut authority: A, ke
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
@ -547,7 +558,8 @@ pub fn test_delete_all<A: Authority<Lookup = AuthLookup>>(mut authority: A, keys
for key in keys {
let name = Name::from_str(key.algorithm().as_str())
.unwrap()
.append_name(&name);
.append_name(&name)
.unwrap();
// append a record
let mut record = Record::with(name.clone(), RecordType::A, 8);
@ -607,7 +619,8 @@ pub fn add_auth<A: Authority<Lookup = AuthLookup>>(authority: &mut A) -> Vec<Sig
let update_name = Name::from_str("update")
.unwrap()
.append_domain(&authority.origin().to_owned().into());
.append_domain(&authority.origin().to_owned().into())
.unwrap();
let mut keys = Vec::<Signer>::new();