diff options
author | 2019-07-27 15:06:50 +0000 | |
---|---|---|
committer | 2019-07-27 08:06:50 -0700 | |
commit | 92a636df53c16047a7523d499811ac0df41edaf3 (patch) | |
tree | f65be786242616193ed0d4efefc4bee330e77d10 /plugin | |
parent | 7a3371d740065d4a0e321abe27fe090300a4ce4f (diff) | |
download | coredns-92a636df53c16047a7523d499811ac0df41edaf3.tar.gz coredns-92a636df53c16047a7523d499811ac0df41edaf3.tar.zst coredns-92a636df53c16047a7523d499811ac0df41edaf3.zip |
plugin/file: z.Expired needs be read under a rlock (#3056)
Read lock before reading the Expired field of a zone.
Fixes: #3053
Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/file/file.go | 5 | ||||
-rw-r--r-- | plugin/file/zone.go | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/plugin/file/file.go b/plugin/file/file.go index c63fa43f5..8e10499fa 100644 --- a/plugin/file/file.go +++ b/plugin/file/file.go @@ -69,7 +69,10 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i return dns.RcodeSuccess, nil } - if z.Expired != nil && *z.Expired { + z.RLock() + exp := z.Expired + z.RUnlock() + if exp != nil && *exp { log.Errorf("Zone %s is expired", zone) return dns.RcodeServerFailure, nil } diff --git a/plugin/file/zone.go b/plugin/file/zone.go index 1fcfc5d33..d3adca29e 100644 --- a/plugin/file/zone.go +++ b/plugin/file/zone.go @@ -22,13 +22,13 @@ type Zone struct { file string *tree.Tree Apex + Expired *bool sync.RWMutex TransferTo []string StartupOnce sync.Once TransferFrom []string - Expired *bool ReloadInterval time.Duration reloadShutdown chan bool |