summaryrefslogtreecommitdiffstats
path: root/ipaserver/plugins
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2016-08-06 11:12:13 +0300
committerMartin Babinsky <mbabinsk@redhat.com>2016-08-22 14:03:00 +0200
commit62be554540e83e54c8cc06ebc2cb1253c2cebeca (patch)
treedb3b9b95a68d9f203e8cf70728858d4e40807c49 /ipaserver/plugins
parent9b3819ea94d3fd8e866d38ccba2051446d057ecd (diff)
downloadfreeipa-62be554540e83e54c8cc06ebc2cb1253c2cebeca.tar.gz
freeipa-62be554540e83e54c8cc06ebc2cb1253c2cebeca.tar.xz
freeipa-62be554540e83e54c8cc06ebc2cb1253c2cebeca.zip
trust: make sure ID range is created for the child domain even if it exists
ID ranges for child domains of a forest trust were created incorrectly in FreeIPA 4.4.0 due to refactoring of -- if the domain was already existing, we never attempted to create the ID range for it. At the same time, when domain was missing, we attempted to add ID range and passed both forest root and the child domain names to add_range(). However, add_range() only looks at the first positional argument which was the forest root name. That ID range always exists (it is created before child domains are processed). Modify the code to make sure child domain name is passed as the first positional argument. In addition, the oddjob helper should explicitly set context='server' so that idrange code will be able to see and use ipaserver/dcerpc.py helpers. Resolves: https://fedorahosted.org/freeipa/ticket/5738 Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
Diffstat (limited to 'ipaserver/plugins')
-rw-r--r--ipaserver/plugins/trust.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/ipaserver/plugins/trust.py b/ipaserver/plugins/trust.py
index 8a25b560f..b9d9b122a 100644
--- a/ipaserver/plugins/trust.py
+++ b/ipaserver/plugins/trust.py
@@ -1690,15 +1690,19 @@ def add_new_domains_from_trust(myapi, trustinstance, trust_entry, domains, **opt
if 'raw' in options:
dom['raw'] = options['raw']
- res = myapi.Command.trustdomain_add(trust_name, name, **dom)
- result.append(res['result'])
+ try:
+ res = myapi.Command.trustdomain_add(trust_name, name, **dom)
+ result.append(res['result'])
+ except errors.DuplicateEntry:
+ # Ignore updating duplicate entries
+ pass
if idrange_type != u'ipa-ad-trust-posix':
range_name = name.upper() + '_id_range'
dom['range_type'] = u'ipa-ad-trust'
add_range(myapi, trustinstance,
range_name, dom['ipanttrusteddomainsid'],
- trust_name, name, **dom)
+ name, **dom)
except errors.DuplicateEntry:
# Ignore updating duplicate entries
pass