Prevent installation with single label domains

Adds validation to prevent user to install ipa with single label
domain.

https://pagure.io/freeipa/issue/7207

Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
This commit is contained in:
Aleksei Slaikovskii
2017-11-09 11:32:31 +01:00
committed by Michal Reznik
parent f4a208311a
commit 905ab93c95
5 changed files with 43 additions and 2 deletions
+17 -1
View File
@@ -22,10 +22,12 @@
Test the `ipaserver/plugins/config.py` module.
"""
from ipalib import errors
from ipalib import api, errors
from ipatests.test_xmlrpc.xmlrpc_test import Declarative
import pytest
domain = api.env.domain
sl_domain = 'singlelabeldomain'
@pytest.mark.tier1
class test_config(Declarative):
@@ -211,4 +213,18 @@ class test_config(Declarative):
summary=None,
),
),
dict(
desc='Check if domain resolution order does not accept SLD',
command=(
'config_mod', [], {
'ipadomainresolutionorder': u'{domain}:{sl_domain}'.format(
domain=domain, sl_domain=sl_domain)}),
expected=errors.ValidationError(
name=u'ipadomainresolutionorder',
error=(
u"Invalid domain name '{}': "
"single label domains are not supported").format(
sl_domain),
),
),
]
@@ -33,6 +33,7 @@ our_domain = api.env.domain
new_domain_1 = u'example1.com'
new_domain_2 = u'example2.com'
bad_domain = u'doesnotexist.test'
sl_domain = u'singlelabeldomain'
@pytest.mark.tier1
@@ -280,4 +281,12 @@ class test_realmdomains(Declarative):
),
),
),
dict(
desc='Add a single label domain {}'.format(sl_domain),
command=('realmdomains_mod', [], {'add_domain': sl_domain}),
expected=errors.ValidationError(
name='add_domain',
error='single label domains are not supported'
),
)
]