Commit 92a636df authored by Miek Gieben's avatar Miek Gieben Committed by Yong Tang

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: default avatarMiek Gieben <miek@miek.nl>
parent 7a3371d7
...@@ -69,7 +69,10 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i ...@@ -69,7 +69,10 @@ func (f File) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (i
return dns.RcodeSuccess, nil 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) log.Errorf("Zone %s is expired", zone)
return dns.RcodeServerFailure, nil return dns.RcodeServerFailure, nil
} }
......
...@@ -22,13 +22,13 @@ type Zone struct { ...@@ -22,13 +22,13 @@ type Zone struct {
file string file string
*tree.Tree *tree.Tree
Apex Apex
Expired *bool
sync.RWMutex sync.RWMutex
TransferTo []string TransferTo []string
StartupOnce sync.Once StartupOnce sync.Once
TransferFrom []string TransferFrom []string
Expired *bool
ReloadInterval time.Duration ReloadInterval time.Duration
reloadShutdown chan bool reloadShutdown chan bool
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment