Skip to content

Commit

Permalink
add domain name checks in RR
Browse files Browse the repository at this point in the history
  • Loading branch information
valesteban committed Nov 17, 2023
1 parent c90aadc commit 89d8be3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/domain_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ impl DomainName {
};
}
}

}

// Setters Domain Name
Expand Down
8 changes: 6 additions & 2 deletions src/message/resource_record.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::message::rdata::Rdata;
use crate::message::Rclass;
use crate::message::Rtype;
use crate::utils;

use crate::domain_name::DomainName;
use std::fmt;
Expand Down Expand Up @@ -183,8 +184,10 @@ impl ResourceRecord {
) -> Result<(ResourceRecord, &'a [u8]), &'static str> {
let domain_name_result = DomainName::from_bytes(bytes, full_msg.clone());

match domain_name_result {
Ok(_) => {}
match domain_name_result.clone() {
Ok((domain_name,_)) => {
utils::domain_validity_syntax(domain_name)?;
}
Err(e) => return Err(e),
}

Expand Down Expand Up @@ -392,6 +395,7 @@ impl ResourceRecord {
let qtype = Rtype::from_rtype_to_str(self.get_rtype());
qtype
}

}

/// Setters
Expand Down

0 comments on commit 89d8be3

Please sign in to comment.