Skip to content

Commit

Permalink
(StackExchange#3427) Fix OVH native DMARC record update for subdomains
Browse files Browse the repository at this point in the history
Beforehand OVH refused to allow updating native DMARC records that
weren't exactly `_dmarc`. This prevents updating `_dmarc` subdomains
such as `_dmarc.something`. This change makes that test less strict and
allows to now update DMARC records that are subdomains of the zone
domain.
  • Loading branch information
masterzen committed Feb 15, 2025
1 parent 2c4cc0c commit a814bb5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions providers/ovh/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ovh
import (
"errors"
"fmt"
"strings"

"github.com/StackExchange/dnscontrol/v4/models"
"github.com/miekg/dns/dnsutil"
Expand Down Expand Up @@ -184,9 +185,9 @@ func adaptNativeRecord(r *Record) error {
// make sure target is fully unquoted to prevent "Invalid subfield found in DMARC" error
r.Target = models.StripQuotes(r.Target)
}
// DMARC record can be created only for `_dmarc` subdomain
if r.FieldType == "DMARC" && r.SubDomain != "_dmarc" {
return fmt.Errorf("native OVH DMARC record requires subdomain to always be _dmarc, %s given", r.SubDomain)
// DMARC record can be created only for subdomains starting with`_dmarc`
if r.FieldType == "DMARC" && !strings.HasPrefix(r.SubDomain, "_dmarc") {
return fmt.Errorf("native OVH DMARC record requires subdomain to always start with _dmarc, %s given", r.SubDomain)
}
return nil
}
Expand Down

0 comments on commit a814bb5

Please sign in to comment.