Add SRV record target validator

Add missing SRV record target validator to filter out possible
user errors.

https://fedorahosted.org/freeipa/ticket/2308
This commit is contained in:
Martin Kosek
2012-02-03 14:25:53 +01:00
parent cb4b2e6fac
commit e1fecfaf6a
2 changed files with 16 additions and 0 deletions

View File

@@ -888,6 +888,12 @@ class RPRecord(DNSRecord):
rfc = 1183
supported = False
def _srv_target_validator(ugettext, value):
if value == u'.':
# service not available
return
return _domain_name_validator(ugettext, value)
class SRVRecord(DNSRecord):
rrtype = 'SRV'
rfc = 2782
@@ -908,6 +914,7 @@ class SRVRecord(DNSRecord):
maxvalue=65535,
),
Str('target',
_srv_target_validator,
label=_('Target'),
doc=_('The domain name of the target host or \'.\' if the service is decidedly not available at this domain'),
),