1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Make it possible to disable the raw SPF optimizer debug record (#795)

Open to other configuration opens for how best to make this optional. Or
potentially making this an opt in configuration item which would be a
breaking change.

The main reason that someone would want to disable this is if their raw
SPF record goes over the 255 characters. This is potentially another
place that could get some multi string support. But as it is only used
for debugging purposes it seems like there should be a way to outright
disable it too.
This commit is contained in:
Michael Russell
2020-07-31 16:40:22 +02:00
committed by GitHub
parent 4211cf1dc0
commit 237c573c2a
4 changed files with 120 additions and 109 deletions

View File

@@ -741,7 +741,7 @@ function SPF_BUILDER(value) {
if (!value.label) {
value.label = '@';
}
if (!value.raw) {
if (!value.raw && value.raw !== '') {
value.raw = '_rawspf';
}
@@ -752,10 +752,13 @@ function SPF_BUILDER(value) {
// If flattening is requested, generate a TXT record with the raw SPF settings.
if (value.flatten && value.flatten.length > 0) {
p.flatten = value.flatten.join(',');
if (value.ttl) {
r.push(TXT(value.raw, rawspf, TTL(value.ttl)));
} else {
r.push(TXT(value.raw, rawspf));
// Only add the raw spf record if it isn't an empty string
if (value.raw !== '') {
if (value.ttl) {
r.push(TXT(value.raw, rawspf, TTL(value.ttl)));
} else {
r.push(TXT(value.raw, rawspf));
}
}
}