Prevent is_subrecord iterating past the domain name itself.

Change-Id: I828f3ec6064e45c3428e96ce4c4fb8ead8827abf
This commit is contained in:
Kiall Mac Innes 2013-03-12 23:39:03 +00:00
parent b02a03b89a
commit 227d7958c4

View File

@ -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)