Sorry to bug you with another issue but I ran in to an interesting case parsing IPv6 addresses in SPF records. When I try to parse a record including an ipv6 with seven sections and one :: it fails to parse the record.
Here is some minimal code to reproduce the issue:
use mail_auth::{
common::parse::TxtRecordParser,
spf::Spf,
};
fn main() {
let examples = vec![
// Two sections filled in, six to assume 0000
"v=spf1 ip6:fe80::1 -all",
// Three sections filled in, five to assume 0000
"v=spf1 ip6:fe80::0000:1 -all",
// Four sections filled in, four to assume 0000
"v=spf1 ip6:fe80:0000::0000:1 -all",
// Five sections filled in, three to assume 0000
"v=spf1 ip6:fe80:0000:0000:0000::1 -all",
// Six sections filled in, two to assume 0000
"v=spf1 ip6:fe80:0000:0000:0000::0000:1 -all",
// Seven sections filled in, one to assume 0000
"v=spf1 ip6:fe80:0000:0000::0000:0000:0000:1 -all",
// Seven sections filled in, one to assume 0000
"v=spf1 ip6:fe80::0000:0000:0000:0000:0000:1 -all",
// Eight sections filled in, nothing to assume
"v=spf1 ip6:fe80:0000:0000:0000:0000:0000:0000:1 -all",
];
for ipv6_spf in examples {
println!("Parsing {}", ipv6_spf);
match Spf::parse(ipv6_spf.as_bytes()) {
Ok(policy) => println!("{:?}", policy),
Err(error) => println!("{:?}", error),
};
}
}
Hey,
Sorry to bug you with another issue but I ran in to an interesting case parsing IPv6 addresses in SPF records. When I try to parse a record including an ipv6 with seven sections and one
::
it fails to parse the record.Here is some minimal code to reproduce the issue: