summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hoffend <dh@dotlan.net>2020-02-25 12:06:25 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2020-02-25 12:06:25 +0100
commit21b4a29579056d1287a04acb5648b760e31c9fd9 (patch)
tree1719d201d0fcb02961aa4e34a23301f3cbc3269c
parentbe4b72192ceeb717c077d6fd585eb6153bcdef1f (diff)
downloadpykolab-21b4a29579056d1287a04acb5648b760e31c9fd9.tar.gz
compare namingtext with basedn always in lowercase
Summary: When the hosted_domain_rootdn contains uppercase letters (only happens when crafting our own ldap naming context, or connecting with an existing ldap directory) kolabd doesn't match the namespace and therefore doesn't track changes and kolabd doesn't create or delete the mailboxes. Test Plan: Initial Situation mgmt_root_dn = dc=mgmt,dc=dotlan,dc=info hosted_root_dn = o=Hosting Starting kolabd via cli with debug enabled /usr/sbin/kolabd -l DEBUG -d 9 --user kolab --pid-file /run/kolabd/kolabd.pid Log messages about which domains / naming contexts to watch: 2020-01-17 23:29:35,260 pykolab.daemon DEBUG [8525] Domain 'mgmt.dotlan.info' naming context: 'dc=mgmt,dc=dotlan,dc=info', root dn: 'dc=mgmt,dc=dotlan,dc=info' 2020-01-17 23:29:35,268 pykolab.daemon DEBUG [8525] Domain 'hosting.com' naming context: None, root dn: 'o=Hosting' 2020-01-17 23:29:35,268 pykolab.daemon DEBUG [8525] Naming contexts to synchronize: [None, 'dc=mgmt,dc=dotlan,dc=info'] 2020-01-17 23:29:35,268 pykolab.daemon DEBUG [8525] Result set of domains: ['mgmt.dotlan.info'] Adding a Child domain (testdomain.com): 2020-01-17 23:36:16,505 pykolab.daemon DEBUG [9149] Domain 'mgmt.dotlan.info' naming context: 'dc=mgmt,dc=dotlan,dc=info', root dn: 'dc=mgmt,dc=dotlan,dc=info' 2020-01-17 23:36:16,513 pykolab.daemon DEBUG [9149] Domain 'hosting.com' naming context: None, root dn: 'o=Hosting' 2020-01-17 23:36:16,522 pykolab.daemon DEBUG [9149] Domain 'testdomain.com' naming context: None, root dn: 'ou=testdomain.com,o=Hosting' 2020-01-17 23:36:16,522 pykolab.daemon DEBUG [9149] Naming contexts to synchronize: [None, 'dc=mgmt,dc=dotlan,dc=info'] 2020-01-17 23:36:16,523 pykolab.daemon DEBUG [9149] Result set of domains: ['mgmt.dotlan.info'] Adding a user doesn't create the mailbox because kolabd isn't watching the naming context of o=Hosting After applying the patch: 2020-01-17 23:38:36,633 pykolab.daemon DEBUG [9499] Domain 'mgmt.dotlan.info' naming context: 'dc=mgmt,dc=dotlan,dc=info', root dn: 'dc=mgmt,dc=dotlan,dc=info' 2020-01-17 23:38:36,646 pykolab.daemon DEBUG [9499] Domain 'hosting.com' naming context: 'o=hosting', root dn: 'o=Hosting' 2020-01-17 23:38:36,655 pykolab.daemon DEBUG [9499] Domain 'testdomain.com' naming context: 'o=hosting', root dn: 'ou=testdomain.com,o=Hosting' 2020-01-17 23:38:36,656 pykolab.daemon DEBUG [9499] Naming contexts to synchronize: ['o=hosting', 'dc=mgmt,dc=dotlan,dc=info'] 2020-01-17 23:38:36,656 pykolab.daemon DEBUG [9499] Result set of domains: ['mgmt.dotlan.info', 'hosting.com'] Creating a user (to prove the patch works) 2020-01-17 23:41:13,756 pykolab.auth DEBUG [9502] LDAP Search Result Data Entry: 2020-01-17 23:41:13,756 pykolab.auth DEBUG [9502] DN: 'uid=jdoe,ou=People,ou=testdomain.com,o=Hosting' 2020-01-17 23:41:13,756 pykolab.auth DEBUG [9502] Entry: {'displayName': ['Doe, John'], 'cn': ['John Doe'], 'mailQuota': ['1048576'], 'preferredLanguage': ['de_DE'], 'userPassword': ['{PBKDF2_SHA256}AAAIABAeq5TwN6vcCAtBi+jspdlAXeGX5v5FV76uVIWxC5cQ4+23wbfR40aYr+SPzT2AP+Pg17N2hFxXDh3OI9qe/j5bE3A4Nz5utCJahvmorowGTIUA0DJrT6kz8Hy2X7PA8wjeZzedKvjdsqODIYDMdDm4DMNMbwU0pVFKgqWYBf7pNCAa/ZZ7lPPIxVXBC3z7Xhmi0mhxzVbY3TjNptxT9lGJ1Z4JCjID8B+BEqpPSKPJzW5sozgqTUYC8EH37bIn+JsmyMbukepz/0DU3oAKcda0j3VOdnfNE3lQ4tBS9e1CrjRVhzx+7H2ehAdu3olq7xHBRW9Po59hP3+X7nvU9C1lwt5stfv7hnEJ15jyy1JXDzoABUUIYxTxGz+uhP1oyuMHAxqxPDrJikdbCBx4ucGLnTnfFXwtAeuMefRsctMl'], 'nsuniqueid': ['6f0ae601-397a11ea-9892ad7b-e428d0cf'], 'objectClass': ['inetorgperson', 'inetuser', 'kolabinetorgperson', 'mailrecipient', 'organizationalperson', 'person', 'top'], 'sn': ['Doe'], 'mail': ['john.doe@testdomain.com'], 'givenName': ['John'], 'modifytimestamp': ['20200117224113Z'], 'uid': ['jdoe']} 2020-01-17 23:41:13,756 pykolab.auth DEBUG [9502] Entry Change Notification attributes: 2020-01-17 23:41:13,757 pykolab.auth DEBUG [9502] Change Type: 1 ('add') 2020-01-17 23:41:13,757 pykolab.auth DEBUG [9502] Previous DN: None Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Differential Revision: https://git.kolab.org/D913
-rw-r--r--kolabd/__init__.py4
-rw-r--r--pykolab/auth/ldap/__init__.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/kolabd/__init__.py b/kolabd/__init__.py
index 98cd6ed..491eaef 100644
--- a/kolabd/__init__.py
+++ b/kolabd/__init__.py
@@ -289,8 +289,8 @@ class KolabDaemon:
level=8
)
- domain_root_dns[primary] = domain_root_dn
- naming_contexts[primary] = naming_context
+ domain_root_dns[primary] = domain_root_dn.lower()
+ naming_contexts[primary] = naming_context.lower()
log.debug(
_l("Naming contexts to synchronize: %r") % (
diff --git a/pykolab/auth/ldap/__init__.py b/pykolab/auth/ldap/__init__.py
index f76f684..4ad86fa 100644
--- a/pykolab/auth/ldap/__init__.py
+++ b/pykolab/auth/ldap/__init__.py
@@ -2378,7 +2378,7 @@ class LDAP(Base):
# If we have a 1:1 match, continue as planned
for naming_context in naming_contexts:
- if self.domain_rootdns[domain].endswith(naming_context):
+ if self.domain_rootdns[domain].lower().endswith(naming_context):
return naming_context
def _primary_domain_for_naming_context(self, naming_context):