ishcherb / rpms / freeipa

Forked from rpms/freeipa 6 years ago
Clone
Blob Blame History Raw
From e14b13000890ff13cb9c062e6a32e1e127587bc7 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mkosek@redhat.com>
Date: Wed, 11 Jan 2012 10:06:39 +0100
Subject: [PATCH 2/3] Fix LDAP add calls in replication module

Replace conn.add_s(entry) with conn.addEntry(entry) to avoid
function calls with an invalid number of parameters.

https://fedorahosted.org/freeipa/ticket/2139
---
 ipaserver/install/replication.py |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index a6bd7af37bb7c6761841d68ff733276045a7ddab..8f0f226dbacc0ee3b84357c059c91936af034fed 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -225,8 +225,8 @@ class ReplicationManager(object):
         ent.setValues("sn", "replication manager pseudo user")
 
         try:
-            conn.add_s(ent)
-        except ldap.ALREADY_EXISTS:
+            conn.addEntry(ent)
+        except errors.DuplicateEntry:
             conn.modify_s(dn, [(ldap.MOD_REPLACE, "userpassword", pw)])
             pass
 
@@ -275,7 +275,7 @@ class ReplicationManager(object):
         entry.setValues('nsds5replicabinddn', [replica_binddn])
         entry.setValues('nsds5replicalegacyconsumer', "off")
 
-        conn.add_s(entry)
+        conn.addEntry(entry)
 
     def setup_changelog(self, conn):
         dn = "cn=changelog5, cn=config"
@@ -285,8 +285,8 @@ class ReplicationManager(object):
         entry.setValues('cn', "changelog5")
         entry.setValues('nsslapd-changelogdir', dirpath)
         try:
-            conn.add_s(entry)
-        except ldap.ALREADY_EXISTS:
+            conn.addEntry(entry)
+        except errors.DuplicateEntry:
             return
 
     def setup_chaining_backend(self, conn):
@@ -308,11 +308,11 @@ class ReplicationManager(object):
                 entry.setValues('nsmultiplexorbinddn', self.repl_man_dn)
                 entry.setValues('nsmultiplexorcredentials', self.repl_man_passwd)
 
-                self.conn.add_s(entry)
+                self.conn.addEntry(entry)
                 done = True
-            except ldap.ALREADY_EXISTS:
+            except errors.DuplicateEntry:
                 benum += 1
-            except ldap.LDAPError, e:
+            except errors.ExecutionError, e:
                 print "Could not add backend entry " + dn, e
                 raise
 
@@ -376,7 +376,7 @@ class ReplicationManager(object):
         entry.setValues("objectclass", ["account", "simplesecurityobject"])
         entry.setValues("uid", "passsync")
         entry.setValues("userPassword", password)
-        conn.add_s(entry)
+        conn.addEntry(entry)
 
         # Add it to the list of users allowed to bypass password policy
         extop_dn = "cn=ipa_pwd_extop,cn=plugins,cn=config"
@@ -470,7 +470,7 @@ class ReplicationManager(object):
         if iswinsync:
             self.setup_winsync_agmt(entry, win_subtree)
 
-        a_conn.add_s(entry)
+        a_conn.addEntry(entry)
 
         entry = a_conn.waitForEntry(entry)
 
@@ -746,7 +746,7 @@ class ReplicationManager(object):
         entry.setValues("ipaConfigString", "winsync:%s" % self.hostname)
 
         try:
-            self.conn.add_s(entry)
+            self.conn.addEntry(entry)
         except Exception, e:
             logging.info("Failed to create public entry for winsync replica")
 
-- 
1.7.7.5