Fix TXT record parsing

TXT record validation fails to parse the record if it contains
spaces. Standard DNS part parser uses a space to divide record
parts. A special parser thus need to be implemented for this RR
type.

https://fedorahosted.org/freeipa/ticket/2306
This commit is contained in:
Martin Kosek
2012-02-03 10:01:27 +01:00
parent 2a667d94ec
commit e41282fbc6
2 changed files with 24 additions and 0 deletions

View File

@@ -1003,6 +1003,10 @@ class TXTRecord(DNSRecord):
),
)
def _get_part_values(self, value):
# ignore any space in TXT record
return (value,)
_dns_records = (
ARecord(),
AAAARecord(),
@@ -1536,6 +1540,8 @@ class dnsrecord(LDAPObject):
u'dnsdata' : dnsvalue
}
values = param._get_part_values(dnsvalue)
if values is None:
continue
for val_id, val in enumerate(values):
if val is not None:
dnsentry[parts_params[val_id].name] = val