Pull request: 3115 domain case
Merge in DNS/adguard-home from 3115-domain-case to master Updates #3115. Squashed commit of the following: commit 02b6d27d862b3e3dc2a17220cec35f0f18e31fb3 Author: Eugene Burkov <e.burkov@adguard.com> Date: Tue May 11 19:56:06 2021 +0300 all: fix typos commit cdd1de64d5f79605b5fdcad5879204194856b083 Author: Eugene Burkov <e.burkov@adguard.com> Date: Tue May 11 19:37:37 2021 +0300 dnsforward: fix disallowed domains case matching
This commit is contained in:
parent
e27525eac6
commit
f41d5b9867
|
@ -17,6 +17,12 @@ and this project adheres to
|
|||
## [v0.106.3] - 2021-05-17 (APPROX.)
|
||||
-->
|
||||
|
||||
### Fixed
|
||||
|
||||
- Disallowed domains are now case-insensitive ([#3115]).
|
||||
|
||||
[#3115]: https://github.com/AdguardTeam/AdGuardHome/issues/3115
|
||||
|
||||
|
||||
|
||||
## [v0.106.2] - 2021-05-06
|
||||
|
|
|
@ -47,7 +47,7 @@ func newAccessCtx(allowedClients, disallowedClients, blockedHosts []string) (a *
|
|||
|
||||
b := &strings.Builder{}
|
||||
for _, s := range blockedHosts {
|
||||
aghstrings.WriteToBuilder(b, s, "\n")
|
||||
aghstrings.WriteToBuilder(b, strings.ToLower(s), "\n")
|
||||
}
|
||||
|
||||
listArray := []filterlist.RuleList{}
|
||||
|
|
|
@ -20,7 +20,11 @@ func (s *Server) beforeRequestHandler(_ *proxy.Proxy, d *proxy.DNSContext) (bool
|
|||
}
|
||||
|
||||
if len(d.Req.Question) == 1 {
|
||||
host := strings.TrimSuffix(d.Req.Question[0].Name, ".")
|
||||
// It's lowercased here since this handler is called before any
|
||||
// other one.
|
||||
name := strings.ToLower(d.Req.Question[0].Name)
|
||||
d.Req.Question[0].Name = name
|
||||
host := strings.TrimSuffix(name, ".")
|
||||
if s.access.IsBlockedDomain(host) {
|
||||
log.Tracef("Domain %s is blocked by settings", host)
|
||||
return false, nil
|
||||
|
|
Loading…
Reference in New Issue