fix(ldap): resolve posixGroup memberUid as bare usernames (#1408) (#1422)

This commit is contained in:
刘祺
2026-04-12 21:55:48 +08:00
committed by GitHub
parent fbdb93f1a7
commit 86152d996c
2 changed files with 49 additions and 1 deletions

View File

@@ -391,6 +391,12 @@ func (s *LdapService) resolveGroupMemberUsername(ctx context.Context, client lda
return norm.NFC.String(username)
}
// posixGroup (and similar) stores bare usernames in memberUid, not DNs. Treat any value
// that is not a valid DN as the username directly — see https://github.com/pocket-id/pocket-id/issues/1408
if _, err := ldap.ParseDN(member); err != nil {
return norm.NFC.String(member)
}
// As a fallback, query LDAP for the referenced entry
userSearchReq := ldap.NewSearchRequest(
member,