Skip to content

fix(user_ldap): do not cache unknown names in the local mapping cache - #66181

Merged
AndyScherzinger merged 1 commit into
masterfrom
fix/ldap-mapping-cache-miss
Nov 3, 2026
Merged

AndyScherzinger merged 1 commit into
masterfrom
fix/ldap-mapping-cache-miss

Conversation

@hweihwang

Copy link
Copy Markdown
Contributor

Summary

AbstractMapping::getDNByName() stored a miss (false) in the local cache for 30 days. When a web request looked up a user or group before it was mapped, and the CLI mapped it afterwards (occ ldap:search, the Sync job), web requests kept treating it as unknown, because the CLI does not write to the local cache. With user_saml and "Only allow authentication if an account exists on some other backend", this locked new AD users out of SSO for up to 30 days.

Now only found DNs are cached, and a cached miss left over from an earlier version is ignored and looked up again.

The new test looks a name up through a mapper with a local cache, maps it through a CLI mapper, and checks that a fresh web mapper finds it, that the miss was never cached, and that found DNs are. It fails without the change, for both user and group mapping. All 421 user_ldap unit tests pass with sqlite. The bug and the effect of the cache were reproduced on 33.0.9 with OpenLDAP and with user_saml 8.1.2 (see #66003).

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

A web request that looked up a user or group before it was mapped stored
the miss in the local cache for 30 days. Mapping it later from the CLI
(occ ldap:search, the Sync job) does not touch that cache, so web
requests kept treating it as unknown. Only found DNs are cached now, and
a cached miss is ignored.

Fixes #66003

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@hweihwang hweihwang added this to the Nextcloud 36 milestone Nov 3, 2026
@hweihwang
hweihwang requested a review from a team as a code owner November 3, 2026 12:39
@come-nc

come-nc commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/backport to stable35

@come-nc

come-nc commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/backport to stable34

@come-nc

come-nc commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

/backport to stable33

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for more than 7 days. As we do not monitor merged or closed pull requests, we are locking this pull request to prevent further comments from getting lost in the noise.
If you discovered any issues with this pull request, please open a new issue instead. In case you want to discuss this pull request or have further questions, please use our forum: https://help.nextcloud.com

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

user_ldap: a lookup before mapping is cached for 30 days, so the user stays unknown in web requests after the sync or occ ldap:search maps them

4 participants