Fix winsync agreements creation

Due to recent addition of ID range support to DsInstance, the class
could no longer be instantiated when realm_name was passed but
ID range parameters were not. This condition broke winsync agreements
creation in ipa-replica-manage.

Make sure that ID range computation in DsInstance does not crash in
this cases so that winsync replica can be created. Also convert --binddn
option of ipa-replica-manage script to IPA native DN type so that
setup_agreement does not crash.

https://fedorahosted.org/freeipa/ticket/2987
This commit is contained in:
Martin Kosek
2012-08-13 09:38:24 +02:00
committed by Rob Crittenden
parent 94d457e83c
commit 6341eff078
4 changed files with 18 additions and 7 deletions

View File

@@ -313,6 +313,10 @@ class DsInstance(service.Service):
def __setup_sub_dict(self):
server_root = find_server_root()
try:
idrange_size = self.idmax - self.idstart + 1
except TypeError:
idrange_size = None
self.sub_dict = dict(FQDN=self.fqdn, SERVERID=self.serverid,
PASSWORD=self.dm_password,
RANDOM_PASSWORD=self.generate_random(),
@@ -323,7 +327,7 @@ class DsInstance(service.Service):
IDMAX=self.idmax, HOST=self.fqdn,
ESCAPED_SUFFIX=str(self.suffix),
GROUP=DS_GROUP,
IDRANGE_SIZE=self.idmax-self.idstart+1
IDRANGE_SIZE=idrange_size
)
def __create_ds_user(self):

View File

@@ -818,7 +818,7 @@ class ReplicationManager(object):
ad_conn.set_option(ldap.OPT_X_TLS_CACERTFILE, cacert)
ad_conn.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
ad_conn.start_tls_s()
ad_conn.simple_bind_s(ad_binddn, ad_pwd)
ad_conn.simple_bind_s(str(ad_binddn), ad_pwd)
res = ad_conn.search_s("", ldap.SCOPE_BASE, '(objectClass=*)',
['defaultNamingContext'])
for dn,entry in res: