diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-02-28 09:05:01 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-02-29 18:58:43 +0100 |
commit | 3dac7a772d3a06741473c175f2d77f5653ec296b (patch) | |
tree | 1b6de6c907e9603f4088e293d3a41398d52b2fe0 /tests | |
parent | 886056904babb20e974a02c6ce77aea829526ea8 (diff) | |
download | freeipa.git-3dac7a772d3a06741473c175f2d77f5653ec296b.tar.gz freeipa.git-3dac7a772d3a06741473c175f2d77f5653ec296b.tar.xz freeipa.git-3dac7a772d3a06741473c175f2d77f5653ec296b.zip |
Improve hostname and domain name validation
DNS plugin did not check DNS zone and DNS record validity and
user was thus able to create domains like "foo bar" or other
invalid DNS labels which would really confuse both user and
bind-dyndb-ldap plugin.
This patch at first consolidates hostname/domain name validators
so that they use common functions and we don't have regular
expressions and other checks defined in several places. These
new cleaned validators are then used for zone/record name
validation.
https://fedorahosted.org/freeipa/ticket/2384
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_xmlrpc/test_dns_plugin.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_xmlrpc/test_dns_plugin.py b/tests/test_xmlrpc/test_dns_plugin.py index 7b1a4532..e3958d23 100644 --- a/tests/test_xmlrpc/test_dns_plugin.py +++ b/tests/test_xmlrpc/test_dns_plugin.py @@ -93,6 +93,19 @@ class test_dns(Declarative): dict( + desc='Try to create zone with invalid name', + command=( + 'dnszone_add', [u'invalid zone'], { + 'idnssoamname': dnszone1_mname, + 'idnssoarname': dnszone1_rname, + 'ip_address' : u'1.2.3.4', + } + ), + expected=errors.ValidationError(name='idnsname', error=''), + ), + + + dict( desc='Create zone %r' % dnszone1, command=( 'dnszone_add', [dnszone1], { @@ -444,6 +457,13 @@ class test_dns(Declarative): dict( + desc='Try to create record with invalid name in zone %r' % dnszone1, + command=('dnsrecord_add', [dnszone1, u'invalid record'], {'arecord': u'127.0.0.1'}), + expected=errors.ValidationError(name='idnsname', error=''), + ), + + + dict( desc='Create record %r in zone %r' % (dnszone1, dnsres1), command=('dnsrecord_add', [dnszone1, dnsres1], {'arecord': u'127.0.0.1'}), expected={ |