Skip to content

Commit

Permalink
BIND: BUGFIX: SOA serial number doesn't change if SOA() used (#2908)
Browse files Browse the repository at this point in the history
  • Loading branch information
tlimoncelli committed May 2, 2024
1 parent bb79c70 commit 3fd6806
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions providers/bind/bindProvider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

"github.com/StackExchange/dnscontrol/v4/models"
"github.com/StackExchange/dnscontrol/v4/pkg/bindserial"
"github.com/StackExchange/dnscontrol/v4/pkg/diff2"
"github.com/StackExchange/dnscontrol/v4/pkg/prettyzone"
"github.com/StackExchange/dnscontrol/v4/pkg/printer"
Expand Down Expand Up @@ -117,14 +118,13 @@ func (s SoaDefaults) String() string {

// bindProvider is the provider handle for the bindProvider driver.
type bindProvider struct {
DefaultNS []string `json:"default_ns"`
DefaultSoa SoaDefaults `json:"default_soa"`
nameservers []*models.Nameserver
directory string
filenameformat string
zonefile string // Where the zone data is e texpected
zoneFileFound bool // Did the zonefile exist?
skipNextSoaIncrease bool // skip next SOA increment (for testing only)
DefaultNS []string `json:"default_ns"`
DefaultSoa SoaDefaults `json:"default_soa"`
nameservers []*models.Nameserver
directory string
filenameformat string
zonefile string // Where the zone data is e texpected
zoneFileFound bool // Did the zonefile exist?
}

// GetNameservers returns the nameservers for a domain.
Expand Down Expand Up @@ -241,7 +241,6 @@ func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundR
desiredSoa = dc.Records[len(dc.Records)-1]
} else {
*desiredSoa = *soaRec
c.skipNextSoaIncrease = true
}

var msgs []string
Expand Down Expand Up @@ -273,8 +272,11 @@ func (c *bindProvider) GetZoneRecordsCorrections(dc *models.DomainConfig, foundR
)

// We only change the serial number if there is a change.
if !c.skipNextSoaIncrease {
desiredSoa.SoaSerial = nextSerial
desiredSoa.SoaSerial = nextSerial

// If the --bindserial flag is used, force the serial to that value
if bindserial.ForcedValue != 0 {
desiredSoa.SoaSerial = uint32(bindserial.ForcedValue & 0xFFFF)
}

corrections = append(corrections,
Expand Down

0 comments on commit 3fd6806

Please sign in to comment.