From 227d7958c4b4a092d490c96b8400c085dc7a2b52 Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Tue, 12 Mar 2013 23:39:03 +0000 Subject: [PATCH] Prevent is_subrecord iterating past the domain name itself. Change-Id: I828f3ec6064e45c3428e96ce4c4fb8ead8827abf --- moniker/central/service.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/moniker/central/service.py b/moniker/central/service.py index 9c85fde3f..16e0a4625 100644 --- a/moniker/central/service.py +++ b/moniker/central/service.py @@ -131,14 +131,17 @@ class Service(rpc_service.Service): return False def _is_subrecord(self, context, domain, record_name, criterion): - # Break the name up into it's component labels - labels = record_name.split(".") + # Break the names up into their component labels + domain_labels = domain['name'].split(".") + record_labels = record_name.split(".") i = 1 + j = len(record_labels) - len(domain_labels) # Starting with label #2, search for matching records's in the database - while (i < len(labels)): - criterion['name'] = '.'.join(labels[i:]) + while (i <= j): + criterion['name'] = '.'.join(record_labels[i:]) + records = self.storage.get_records(context, domain['id'], criterion)