mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user