Skip to content

fix(user_ldap): compare configuration prefixes numerically - #67407

Open
thakurcoderz wants to merge 1 commit into
nextcloud:masterfrom
thakurcoderz:fix/ldap-next-config-prefix-numeric
Open

thakurcoderz wants to merge 1 commit into
nextcloud:masterfrom
thakurcoderz:fix/ldap-next-config-prefix-numeric

Conversation

@thakurcoderz

Copy link
Copy Markdown

Summary

Helper::getNextServerConfigurationPrefix() sorted the existing prefixes as strings and took the last one. As strings, s100 comes before s99, so once there are 100 or more LDAP configurations the "next" prefix comes out as s100 again. Creating a new configuration then reuses the existing one and adds its prefix to configuration_prefixes a second time.

The prefixes are now compared by their number (max() over the numeric parts), so s01, s99, s100 gives s101. The empty legacy prefix still counts as 0.

One side effect: the old code also saved the prefix list back in that string-sorted order. It's now saved in its existing order with the new prefix appended. Nothing reads it in a particular order, and the old order wasn't numeric anyway.

Added a unit test with s01, s99, s100. It fails on master (returns s100) and passes with the change. I haven't reproduced it on a live instance with 100 LDAP configurations; the unit test covers the case directly.

TODO

  • Fix and unit test

Checklist

AI (if applicable)

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

This description was written with Claude Code (claude-opus-5-5). Claude Code also helped with the code; I chose the approach and the test values, and reviewed and tested the change locally.

Assisted by ClaudeCode:claude-opus-5-5

With 100 or more LDAP configurations, sorting the prefixes as strings put s100 before s99, so the next prefix came out as an existing one and that configuration was reused.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: thakurcoderz <91749233+thakurcoderz@users.noreply.github.com>
@thakurcoderz
thakurcoderz requested a review from a team as a code owner December 2, 2026 07:05
@thakurcoderz
thakurcoderz requested review from Altahrim and cristianscheid and removed request for a team December 2, 2026 07:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LDAP: next configuration prefix is computed with a string sort (s100 after s99)

1 participant