diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-04-29 13:48:44 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-05-04 13:48:44 +0100 |
commit | fb7b5d11817333abffea4d484d58bad722c75396 (patch) | |
tree | 9c75ba6e1d697169daabd01c52175422c82c09df | |
parent | 8b001c078ce6aa241c69a2dae517885d9c635ff8 (diff) | |
download | pykolab-fb7b5d11817333abffea4d484d58bad722c75396.tar.gz |
Try using one supported control, and abort the entire synchronization if it succeeds. If the configured control does not succeed, try the next supported control
-rw-r--r-- | pykolab/auth/ldap/__init__.py | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py index 75c11d5..9ca37a9 100644 --- a/pykolab/auth/ldap/__init__.py +++ b/pykolab/auth/ldap/__init__.py @@ -2140,27 +2140,33 @@ class LDAP(pykolab.base.Base): _use_ldap_controls = self.ldap.supported_controls for supported_control in _use_ldap_controls: - exec("""_results = self.%s( - %r, - scope=%r, - filterstr=%r, - attrlist=%r, - attrsonly=%r, - timeout=%r, - callback=callback, - primary_domain=%r, - secondary_domains=%r - )""" % ( - supported_control, - base_dn, - scope, - filterstr, - attrlist, - attrsonly, - timeout, - primary_domain, - secondary_domains + try: + exec("""_results = self.%s( + %r, + scope=%r, + filterstr=%r, + attrlist=%r, + attrsonly=%r, + timeout=%r, + callback=callback, + primary_domain=%r, + secondary_domains=%r + )""" % ( + supported_control, + base_dn, + scope, + filterstr, + attrlist, + attrsonly, + timeout, + primary_domain, + secondary_domains + ) ) - ) + + break + + except: + continue return _results |