From e5117bd995aa10aab59f487058b4a57c8b695be9 Mon Sep 17 00:00:00 2001 From: Ana Krivokapic Date: Fri, 31 May 2013 12:01:23 +0200 Subject: Fail when adding a trust with a different range When adding a trust, if an id range already exists for this trust, and options --base-id/--range-size are provided with the trust-add command, trust-add should fail. https://fedorahosted.org/freeipa/ticket/3635 --- ipaserver/dcerpc.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'ipaserver/dcerpc.py') diff --git a/ipaserver/dcerpc.py b/ipaserver/dcerpc.py index 5d052ea4a..0f98ce83c 100644 --- a/ipaserver/dcerpc.py +++ b/ipaserver/dcerpc.py @@ -816,7 +816,7 @@ class TrustDomainJoins(object): ld.retrieve(installutils.get_fqdn()) self.local_domain = ld - def __populate_remote_domain(self, realm, realm_server=None, realm_admin=None, realm_passwd=None): + def populate_remote_domain(self, realm, realm_server=None, realm_admin=None, realm_passwd=None): def get_instance(self): # Fetch data from foreign domain using password only rd = TrustDomainInstance('') @@ -860,7 +860,14 @@ class TrustDomainJoins(object): if not self.configured: return None - self.__populate_remote_domain(realm, realm_server, realm_admin, realm_passwd) + if not(isinstance(self.remote_domain, TrustDomainInstance)): + self.populate_remote_domain( + realm, + realm_server, + realm_admin, + realm_passwd + ) + if not self.remote_domain.read_only: trustdom_pass = samba.generate_random_password(128, 128) self.remote_domain.establish_trust(self.local_domain, trustdom_pass) @@ -873,6 +880,8 @@ class TrustDomainJoins(object): if not self.configured: return None - self.__populate_remote_domain(realm, realm_server, realm_passwd=None) + if not(isinstance(self.remote_domain, TrustDomainInstance)): + self.populate_remote_domain(realm, realm_server, realm_passwd=None) + self.local_domain.establish_trust(self.remote_domain, trustdom_passwd) return dict(local=self.local_domain, remote=self.remote_domain, verified=False) -- cgit