[Bug]: ContactsManager may overwrite registered addressbook through key/id collission
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
⚠️ This issue respects the following points: ⚠️
- This is a bug, not a question or a configuration/webserver/proxy issue.
- This issue is not already reported on Github (I've searched it).
- Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
- I agree to follow Nextcloud's Code of Conduct.
Bug description
All currently needed addressbooksare being registered with server's ContactsManager::registerAddressBook. Internally, it stores the loaded addressbooks in an array, indexed by the getKey() returned by the registered addressbook.
Now AddressBookImpl::getKey() – implementation of the DAV app in server – returns digits.
The implementation of ldap_contacts_backend's implementation returns digits, too. For the offset is different (on my setup at least), all seems fine when working with one configured LDAP connection (for contacs). With two, one registered addressbook is overwritten and thus not considered further down in he business logic.
The index should not be determined by an external value alone. Namespacing is by the implementing class should be safe.
Steps to reproduce
- enable ldap_contacts_backend
- configure first LDAP backend for this app
- configure second LDAP backend for this app
- In the contacts menu search for a user that is provided by the second LDAP server
Expected behavior
Contact is being shown in the results
Installation method
Manual installation
Operating system
No response
PHP engine version
No response
Web server
No response
Database engine version
No response
Is this bug present after an update or on a fresh install?
No response
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
No response
List of activated Apps
dav and ldap_contacts_backend are sufficient
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading ContactsManager::registerAddressBook and the getKey() implementations in AddressBookImpl and ldap_contacts_backend. Reproduce the issue with two configured LDAP backends, then verify that both addressbooks remain registered and that a user from the second LDAP server appears in contact search.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100