diff options
author | Tomas Babej <tbabej@redhat.com> | 2013-04-25 12:52:36 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-04-25 12:52:36 +0200 |
commit | 8f47e841d1f2af16fd9a52599a56556df2d169f0 (patch) | |
tree | d78f0c1e31ff914fee4a28eeeecc890df1c19735 | |
parent | 89f65ddccd8e08d30ddcedaf1f88fbb54066af0f (diff) | |
download | freeipa-8f47e841d1f2af16fd9a52599a56556df2d169f0.tar.gz freeipa-8f47e841d1f2af16fd9a52599a56556df2d169f0.tar.xz freeipa-8f47e841d1f2af16fd9a52599a56556df2d169f0.zip |
Allow underscore in record targets
Makes record target validation less strict and allows underscore.
This is requirement for IPA sites.
https://fedorahosted.org/freeipa/ticket/3550
-rw-r--r-- | ipalib/plugins/dns.py | 2 | ||||
-rw-r--r-- | tests/test_xmlrpc/test_dns_plugin.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 7bffe09fc..71153b975 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -373,7 +373,7 @@ def _bind_hostname_validator(ugettext, value): try: # Allow domain name which is not fully qualified. These are supported # in bind and then translated as <non-fqdn-name>.<domain>. - validate_hostname(value, check_fqdn=False) + validate_hostname(value, check_fqdn=False, allow_underscore=True) except ValueError, e: return _('invalid domain-name: %s') \ % unicode(e) diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py index eb4356afb..1f3f0d75a 100644 --- a/tests/test_xmlrpc/test_dns_plugin.py +++ b/tests/test_xmlrpc/test_dns_plugin.py @@ -678,7 +678,7 @@ class test_dns(Declarative): 'srv_part_port' : 123, 'srv_part_target' : u'foo bar'}), expected=errors.ValidationError(name='srv_target', - error=u'invalid domain-name: only letters, numbers, and - ' + + error=u'invalid domain-name: only letters, numbers, _, and - ' + u'are allowed. DNS label may not start or end with -'), ), @@ -780,7 +780,7 @@ class test_dns(Declarative): desc='Try to add invalid CNAME record %r using dnsrecord_add' % (dnsrescname), command=('dnsrecord_add', [dnszone1, dnsrescname], {'cnamerecord': u'-.example.com'}), expected=errors.ValidationError(name='hostname', - error=u'invalid domain-name: only letters, numbers, and - ' + + error=u'invalid domain-name: only letters, numbers, _, and - ' + u'are allowed. DNS label may not start or end with -'), ), |