From c48e003872ba810289a209dc5b7dbaadd8aaadec Mon Sep 17 00:00:00 2001 From: Jon Schewe Date: Tue, 9 Aug 2022 14:15:17 -0500 Subject: [PATCH] Fix suggest zone to make sure the zone name is a dns component Need to include '.' before the name to keep from picking a zone based on the end of the hostname that isn't the subdomain. --- powerdns/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/powerdns/interface.py b/powerdns/interface.py index 2c98c77..ae5d509 100644 --- a/powerdns/interface.py +++ b/powerdns/interface.py @@ -238,7 +238,7 @@ def suggest_zone(self, r_name): raise PDNSCanonicalError(r_name) best_match = None for zone in self.zones: - if r_name.endswith(zone.name): + if r_name.endswith('.' + zone.name): if not best_match: best_match = zone if best_match and len(zone.name) > len(best_match.name):