[#737] Fix cn=changelog search failing when aliases are dereferenced#740
Merged
vharseko merged 1 commit intoJul 16, 2026
Merged
Conversation
…es are dereferenced
ChangelogBackend.getEntry threw RuntimeException("Not implemented") instead of
honouring the LocalBackend.getEntry contract of returning null for a missing
entry. Since f771315 the server reads the search base entry before handing the
search to the backend whenever aliases are dereferenced, so every cn=changelog
search with a deref policy of always, find, or subtree-scoped search failed with
result code 80 before ChangelogBackend.search() was ever reached. This broke
clients that dereference aliases by default, JNDI-based ones in particular.
Return the base changelog entry by DN, and null for change records: those need
the search filter and change number range to position their cursors, so they are
only reachable through search(), and none of them is ever an alias.
maximthomas
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #737.
Problem
Any search based at
cn=changelogfails with result code 80 when the client dereferences aliases:ChangelogBackend.getEntrythrewRuntimeException("Not implemented")rather than honouring theLocalBackend.getEntrycontract of returningnullfor a missing entry. That violation was harmless until f771315 ("[#287] ADD alias dereferencing for search requests", #369), which made the server read the search base entry before handing the search over to the backend. The lookup now throws beforeChangelogBackend.search()— which handles these searches fine — is ever reached.This breaks every client that dereferences aliases by default. JNDI sends
derefAliases: alwaysunless told otherwise, so the OpenICF LDAP connector'ssync()cannot read the external change log at all.Fix
Return the base changelog entry by DN, and
nullfor change records. Change records need the search filter and change number range to position their cursors, so they cannot be looked up individually — and none of them is ever an alias, so a caller dereferencing aliases gets the answer it needs and the search proceeds intosearch()as before.This also fixes
entryExistsoncn=changelog, which inherits the defaultgetEntry(dn) != nullimplementation and threw the same way.Testing
ChangelogBackendTestCasepasses in full (30/30). The new tests are parameterized over the three deref policies that trigger the base entry lookup (ALWAYS,FINDING_BASE,IN_SEARCHING):searchInChangeNumberModeWhenDereferencingAliases— the reported reproducer.searchWhenNoChangesShouldReturnRootEntryOnlyWhenDereferencingAliases— base entry on an empty RS.getEntryShouldReturnBaseEntryOnly— the contract itself.Verified they catch the regression rather than merely passing: reverting the
ChangelogBackendchange fails 7 of the 8 with the exactRuntimeException(Not implemented)from the report. The 8th is the pre-existingsearchWhenNoChangesShouldReturnRootEntryOnly, which uses derefNEVERand passes either way — the control case.Related
Two further defects in the same f771315 feature were found while analysing this one and are filed separately; neither is addressed here: