3 commits - pykolab/auth

Jeroen van Meeuwen vanmeeuwen at kolabsys.com
Wed May 22 13:15:42 CEST 2013


 pykolab/auth/__init__.py      |    2 ++
 pykolab/auth/ldap/__init__.py |    8 ++++++++
 pykolab/auth/ldap/syncrepl.py |   27 ++++++++++++++++++++++++++-
 3 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit a0857553dad6fa89bbbacf52484c3f15060fd762
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed May 22 13:15:15 2013 +0200

    Upon deletion of an entry, see if we can get to the value of the result attribute using our cache

diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 441153a..b8afa9c 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -2021,6 +2021,14 @@ class LDAP(pykolab.base.Base):
                 else:
                     change = change_dict['change_type']
 
+                # See if we can find the cache entry - this way we can get to
+                # the value of a (former, on a deleted entry) result_attribute
+                cache_entry = cache.get_entry(self.domain, entry, update=False)
+                result_attribute = conf.get('cyrus-sasl', 'result_attribute')
+
+                if hasattr(cache_entry, 'result_attribute') and change == 'delete':
+                    entry[result_attribute] = cache_entry.result_attribute
+
                 eval(
                         "self._change_%s_%s(entry, change_dict)" % (
                                 change,


commit 91c5c14bd09c7778403227ff4dacaebc4ae222c8
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed May 22 13:10:14 2013 +0200

    Make sure we ship the value of the unique attribute back to the callback (#1875)

diff --git a/pykolab/auth/ldap/syncrepl.py b/pykolab/auth/ldap/syncrepl.py
index e02e086..03ab5ae 100644
--- a/pykolab/auth/ldap/syncrepl.py
+++ b/pykolab/auth/ldap/syncrepl.py
@@ -5,8 +5,13 @@ import ldap
 import ldap.syncrepl
 import ldapurl
 
+import pykolab
+
 from pykolab import utils
 
+log = pykolab.getLogger('pykolab.syncrepl')
+conf = pykolab.getConf()
+
 class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer):
 
     callback = None
@@ -28,16 +33,36 @@ class DNSync(ldap.ldapobject.LDAPObject,ldap.syncrepl.SyncreplConsumer):
             return self.__db['cookie']
 
     def syncrepl_delete(self, uuids):
+        log.debug("syncrepl_delete uuids: %r" % (uuids), level=8)
+
+        # Get the unique_attribute name to issue along with our
+        # callback (if any)
+        unique_attr = conf.get('ldap', 'unique_attribute')
+        if unique_attr == None:
+            unique_attr = 'entryuuid'
+
+        if unique_attr == 'nsuniqueid':
+            log.warning(
+                    _("The name of the persistent, unique attribute " + \
+                    "is very probably not compatible with the use of " + \
+                    "syncrepl.")
+                )
+            
+
         for uuid in uuids:
             dn = self.__db[uuid]
 
+            log.debug("syncrepl_delete dn: %r" % (dn), level=8)
+
             if not self.callback == None:
                 self.callback(
                         change_type='delete',
                         previous_dn=None,
                         change_number=None,
                         dn=dn,
-                        entry={}
+                        entry={
+                                unique_attr: uuid
+                            }
                     )
 
             del self.__db[uuid]


commit 4a95108d5c911f1a0ff3dc8b4dddee71b70700fc
Author: Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen at kolabsys.com>
Date:   Wed May 22 11:47:09 2013 +0200

    Catch a case in which the list of domain name spaces is empty

diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index 6eaa874..f4de1e1 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -228,6 +228,8 @@ class Auth(pykolab.base.Base):
         except:
             if not self.domain == kolab_primary_domain:
                 return [(self.domain, [])]
+            else:
+                domains = []
 
         # If no domains are found, the primary domain is used.
         if len(domains) < 1:





More information about the commits mailing list