From c3366a91e7aacad53d5b06cc9233dc186ed13480 Mon Sep 17 00:00:00 2001 From: Maurus Decimus <11444311+mdecimus@users.noreply.github.com> Date: Tue, 28 Apr 2026 15:32:00 +0200 Subject: [PATCH] LDAP: Generate valid `credentialId` when there are password changes --- CHANGELOG.md | 1 + crates/registry/src/utils/account.rs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index adee0a32..8286d62c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ If you are upgrading from v0.16.x, replace the binary (or run `docker pull`). If - Allow HTTP to be used for configuring the server. ## Fixed +- LDAP: Generate valid `credentialId` when there are password changes. - TLS: Disable cipher suited option disables wrong ciphers. - DNS Updater: - BunnyDNS: Use subdomain as name of record instead of FQDN. diff --git a/crates/registry/src/utils/account.rs b/crates/registry/src/utils/account.rs index ef58f0f4..edc4ca7b 100644 --- a/crates/registry/src/utils/account.rs +++ b/crates/registry/src/utils/account.rs @@ -39,8 +39,10 @@ impl UserAccount { }) { credential.secret = password; } else { + let credential_id = self.next_credential_id().into(); self.credentials .push(Credential::Password(PasswordCredential { + credential_id, secret: password, ..Default::default() })); @@ -86,6 +88,21 @@ impl UserAccount { self.into_password_credential() .map(|credential| credential.secret) } + + pub fn next_credential_id(&self) -> u64 { + self.credentials + .0 + .values() + .map(|credential| match credential { + Credential::Password(credential) => credential.credential_id.id() + 1, + Credential::AppPassword(credential_properties) + | Credential::ApiKey(credential_properties) => { + credential_properties.credential_id.id() + 1 + } + }) + .max() + .unwrap_or_default() + } } impl Credential {