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