Fixes for SPF record parsing

This commit is contained in:
Reimar 2026-02-13 17:43:20 +01:00
parent 36ca29853b
commit 1368a6400c
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268
2 changed files with 10 additions and 10 deletions

View File

@ -26,56 +26,56 @@ export class SpfRecord {
.desc("Match the IP addresses from the MX records of these domains (or current domain if none specified)") .desc("Match the IP addresses from the MX records of these domains (or current domain if none specified)")
.value(ValueRequirement.OPTIONAL) .value(ValueRequirement.OPTIONAL)
.multiple() .multiple()
.pos(2), .pos(1),
new DomainMechanism("ptr") new DomainMechanism("ptr")
.disabled() .disabled()
.value(ValueRequirement.OPTIONAL) .value(ValueRequirement.OPTIONAL)
.multiple() .multiple()
.pos(2), .pos(1),
new IPv4Mechanism("ip4") new IPv4Mechanism("ip4")
.label("IPv4 addresses") .label("IPv4 addresses")
.desc("Match these IP addresses") .desc("Match these IP addresses")
.multiple() .multiple()
.pos(2), .pos(1),
new IPv6Mechanism("ip6") new IPv6Mechanism("ip6")
.label("IPv6 addresses") .label("IPv6 addresses")
.desc("Match these IP addresses") .desc("Match these IP addresses")
.multiple() .multiple()
.pos(2), .pos(1),
new DomainMechanism("include") new DomainMechanism("include")
.label("Include") .label("Include")
.desc("Check the SPF record of another domain. If it passes, return with the selected result") .desc("Check the SPF record of another domain. If it passes, return with the selected result")
.multiple() .multiple()
.pos(2), .pos(1),
new DomainMechanism("exists") new DomainMechanism("exists")
.label("Exists") .label("Exists")
.desc("Apply only if this domain exists (can be used with macro expansions)") .desc("Apply only if this domain exists (can be used with macro expansions)")
.category("advanced") .category("advanced")
.multiple() .multiple()
.pos(2), .pos(1),
new Mechanism("all") new Mechanism("all")
.label("All others") .label("All others")
.desc("How to treat the rest of the IP addresses") .desc("How to treat the rest of the IP addresses")
.value(ValueRequirement.PROHIBITED) .value(ValueRequirement.PROHIBITED)
.pos(3), .pos(2),
new Modifier("redirect") new Modifier("redirect")
.label("Redirect") .label("Redirect")
.desc("Redirect to the SPF record of this domain if no matches were found") .desc("Redirect to the SPF record of this domain if no matches were found")
.category("advanced") .category("advanced")
.pos(4), .pos(3),
new Modifier("exp") new Modifier("exp")
.label("Explanation") .label("Explanation")
.desc("Points to a domain whose TXT record contains an error message if validation fails. Macros can be used here") .desc("Points to a domain whose TXT record contains an error message if validation fails. Macros can be used here")
.category("advanced") .category("advanced")
.pos(4), .pos(3),
]; ];
static categories = { static categories = {

View File

@ -18,7 +18,7 @@ export class IPv4Mechanism extends Mechanism {
}); });
if (segments.length !== 4 || !valid) { if (segments.length !== 4 || !valid) {
throw new ValidationError(`Value for ${key} is not a valid IPv4 address`); throw new ValidationError(`Value for ${this.key} is not a valid IPv4 address`);
} }
return true; return true;