mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
OVH: panic on SPF and DKIM record types (#340)
OVH uses special SPF and DKIM invalid types for records added with the web ui (or default zone records). The ovh provider didn't correctly handle those invalid record types and was panic'ing. This change prevents the panic by converting such records to TXT (which is what they are in fact), but also auto-corrects any SPF or DKIM records to TXT ones.
This commit is contained in:
committed by
Tom Limoncelli
parent
0d52745164
commit
f9d748011e
@ -154,15 +154,17 @@ func nativeToRecord(r *Record, origin string) *models.RecordConfig {
|
|||||||
TTL: uint32(r.TTL),
|
TTL: uint32(r.TTL),
|
||||||
Original: r,
|
Original: r,
|
||||||
}
|
}
|
||||||
|
|
||||||
rtype := r.FieldType
|
rtype := r.FieldType
|
||||||
rec.SetLabel(r.SubDomain, origin)
|
|
||||||
if err := rec.PopulateFromString(rtype, r.Target, origin); err != nil {
|
|
||||||
panic(errors.Wrap(err, "unparsable record received from ovh"))
|
|
||||||
}
|
|
||||||
|
|
||||||
// ovh uses a custom type for SPF and DKIM
|
// ovh uses a custom type for SPF and DKIM
|
||||||
if rtype == "SPF" || rtype == "DKIM" {
|
if rtype == "SPF" || rtype == "DKIM" {
|
||||||
rec.Type = "TXT"
|
rtype = "TXT"
|
||||||
|
}
|
||||||
|
|
||||||
|
rec.SetLabel(r.SubDomain, origin)
|
||||||
|
if err := rec.PopulateFromString(rtype, r.Target, origin); err != nil {
|
||||||
|
panic(errors.Wrap(err, "unparsable record received from ovh"))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ovh default is 3600
|
// ovh default is 3600
|
||||||
|
Reference in New Issue
Block a user