Set the list of blocked names even if logging was not enabled

Fixes #1050
This commit is contained in:
Frank Denis 2019-11-18 01:42:51 +01:00
parent 0790328424
commit 925c12d334
1 changed files with 2 additions and 2 deletions

View File

@ -70,12 +70,12 @@ func (plugin *PluginBlockName) Init(proxy *Proxy) error {
continue continue
} }
} }
plugin.blockedNames = &blockedNames
if len(proxy.blockNameLogFile) == 0 { if len(proxy.blockNameLogFile) == 0 {
return nil return nil
} }
blockedNames.logger = &lumberjack.Logger{LocalTime: true, MaxSize: proxy.logMaxSize, MaxAge: proxy.logMaxAge, MaxBackups: proxy.logMaxBackups, Filename: proxy.blockNameLogFile, Compress: true} blockedNames.logger = &lumberjack.Logger{LocalTime: true, MaxSize: proxy.logMaxSize, MaxAge: proxy.logMaxAge, MaxBackups: proxy.logMaxBackups, Filename: proxy.blockNameLogFile, Compress: true}
blockedNames.format = proxy.blockNameFormat blockedNames.format = proxy.blockNameFormat
plugin.blockedNames = &blockedNames
return nil return nil
} }
@ -89,7 +89,7 @@ func (plugin *PluginBlockName) Reload() error {
} }
func (plugin *PluginBlockName) Eval(pluginsState *PluginsState, msg *dns.Msg) error { func (plugin *PluginBlockName) Eval(pluginsState *PluginsState, msg *dns.Msg) error {
if pluginsState.sessionData["whitelisted"] != nil { if plugin.blockedNames == nil || pluginsState.sessionData["whitelisted"] != nil {
return nil return nil
} }
questions := msg.Question questions := msg.Question