mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Re-use trust domain retrieval code in certmap validators
https://pagure.io/freeipa/issue/6372 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
This commit is contained in:
parent
544d66b710
commit
4e5e3eebb2
@ -100,16 +100,11 @@ def check_associateddomain_is_trusted(api_inst, options):
|
|||||||
"""
|
"""
|
||||||
domains = options.get('associateddomain')
|
domains = options.get('associateddomain')
|
||||||
if domains:
|
if domains:
|
||||||
trust_suffix_namespace = set()
|
trusted_domains = api_inst.Object.config.gather_trusted_domains()
|
||||||
|
trust_suffix_namespace = {dom_name.lower() for dom_name in
|
||||||
|
trusted_domains}
|
||||||
trust_suffix_namespace.add(api_inst.env.domain.lower())
|
trust_suffix_namespace.add(api_inst.env.domain.lower())
|
||||||
|
|
||||||
trust_objects = api_inst.Command.trust_find(sizelimit=0)['result']
|
|
||||||
for obj in trust_objects:
|
|
||||||
trustdomains = api_inst.Command.trustdomain_find(
|
|
||||||
obj['cn'][0], sizelimit=0)['result']
|
|
||||||
for domain in trustdomains:
|
|
||||||
trust_suffix_namespace.add(domain['cn'][0].lower())
|
|
||||||
|
|
||||||
for dom in domains:
|
for dom in domains:
|
||||||
if not str(dom).lower() in trust_suffix_namespace:
|
if not str(dom).lower() in trust_suffix_namespace:
|
||||||
raise errors.ValidationError(
|
raise errors.ValidationError(
|
||||||
|
Loading…
Reference in New Issue
Block a user