summaryrefslogtreecommitdiffstats
path: root/pykolab
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-08-14 10:55:10 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2015-08-14 10:55:10 +0200
commit52dc31ae701544199449a18389eaf42c053ab06b (patch)
treed4fb11c6e9e073824842b82730b550b9410cad5c /pykolab
parent85e77768a6658c9676908b1f360ed2c7347ff4c9 (diff)
downloadpykolab-52dc31ae701544199449a18389eaf42c053ab06b.tar.gz
Translate naming contexts back to domain name spaces or the list of processes becomes volatile
Diffstat (limited to 'pykolab')
-rw-r--r--pykolab/auth/__init__.py3
-rw-r--r--pykolab/auth/ldap/__init__.py10
2 files changed, 13 insertions, 0 deletions
diff --git a/pykolab/auth/__init__.py b/pykolab/auth/__init__.py
index e9c6c44..ed5865f 100644
--- a/pykolab/auth/__init__.py
+++ b/pykolab/auth/__init__.py
@@ -274,6 +274,9 @@ class Auth(pykolab.base.Base):
def domain_naming_context(self, domain):
return self._auth._domain_naming_context(domain)
+ def primary_domain_for_naming_context(self, domain):
+ return self._auth._primary_domain_for_naming_context(domain)
+
def get_entry_attribute(self, domain, entry, attribute):
return self._auth.get_entry_attribute(entry, attribute)
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index 5b4f31f..9d190ac 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -2104,6 +2104,16 @@ class LDAP(pykolab.base.Base):
if self.domain_rootdns[domain].endswith(naming_context):
return naming_context
+ def _primary_domain_for_naming_context(self, naming_context):
+ self._bind()
+
+ _domain = '.'.join(naming_context.split(',dc='))[3:]
+
+ _naming_context = self._kolab_domain_root_dn(_domain)
+
+ if naming_context == _naming_context:
+ return _domain
+
def _entry_dict(self, value):
"""
Tests if 'value' is a valid entry dictionary with a DN contained