Skip to content

Conversation

@yaemiku
Copy link

@yaemiku yaemiku commented Sep 21, 2025

I have come across PR #346 while looking for a way to have a music server that integrates with LDAP. I managed to get it working for me. I have

  • Fixed the LDAP authentication logic. Auth is performed solely against the LDAP database. Users who pass the user filter are automatically registered when trying to log in for the first time. Users who pass the admin filter are assigned admin privileges
  • While testing, I noticed that the "Tempo" subsonic client sends the password parameter hex-encrypted (in the form of "p=enc:HEXHERE"). Added support for that as well

@betapictoris
Copy link
Contributor

Heya! Thanks a bunch for picking this up, I meant to fix that linting error but life got in the way. I've done a very informal glance over the code and everything looked pretty good, but I just had two questions/comments. The first is on:

+ //nolint:gochecknoglobals
  var ldapStore = make(LDAPStore)

This line is the reason that #346 wasn't getting merged, ldap.LDAPStore needs to be refactored out of ldap/ldap.go and into cmd/gonic/gonic.go to match the style of the rest of the code. I did the work to get ldap.Config into there, but never got a chance to do that with ldap.LDAPStore. In hindsight a very easy solution to this would be to create a structure within ldap/ldap.go, say ldap.State, that has fields for both the configuration and authentication cache.

- if doesLDAPUserExist(username, config, l) && !isAdmin {
+ if !doesLDAPUserExist(username, config, l) {

Does this work if someone wants to configure two different filters for admin and user accounts? I know it seems like an edge case, but given how different each LDAP server is configured it didn't seem like that bad of an idea when I was originally writing that code.

Just out of curiosity, how has it been working for you over the past couple of weeks?

@sentriz sentriz force-pushed the master branch 5 times, most recently from 7decea6 to 971d22d Compare November 11, 2025 07:01
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.

2 participants