Skip to content

[#737] Fix cn=changelog search failing when aliases are dereferenced#740

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-737-changelog-alias-deref
Jul 16, 2026
Merged

[#737] Fix cn=changelog search failing when aliases are dereferenced#740
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:issue-737-changelog-alias-deref

Conversation

@vharseko

Copy link
Copy Markdown
Member

Fixes #737.

Problem

Any search based at cn=changelog fails with result code 80 when the client dereferences aliases:

error code 80 - An unexpected error was encountered while processing a search in one of the
Directory Server backends: RuntimeException(Not implemented)

ChangelogBackend.getEntry threw RuntimeException("Not implemented") rather than honouring the LocalBackend.getEntry contract of returning null for 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 before ChangelogBackend.search() — which handles these searches fine — is ever reached.

This breaks every client that dereferences aliases by default. JNDI sends derefAliases: always unless told otherwise, so the OpenICF LDAP connector's sync() cannot read the external change log at all.

Fix

Return the base changelog entry by DN, and null for 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 into search() as before.

This also fixes entryExists on cn=changelog, which inherits the default getEntry(dn) != null implementation and threw the same way.

Testing

ChangelogBackendTestCase passes 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 ChangelogBackend change fails 7 of the 8 with the exact RuntimeException(Not implemented) from the report. The 8th is the pre-existing searchWhenNoChangesShouldReturnRootEntryOnly, which uses deref NEVER and 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:

…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.
@vharseko
vharseko requested a review from maximthomas July 15, 2026 12:55
@vharseko vharseko added bug java Pull requests that update java code replication labels Jul 15, 2026
@vharseko
vharseko merged commit ba2b247 into OpenIdentityPlatform:master Jul 16, 2026
28 of 29 checks passed
@vharseko
vharseko deleted the issue-737-changelog-alias-deref branch July 16, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug java Pull requests that update java code replication

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Searching cn=changelog fails with RuntimeException(Not implemented) when aliases are dereferenced

2 participants