LDAP manager attribute not being synced correctly in AD (was: LDAP Sync fails after adding manager attribue on 6.0 stable (Error 500))
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
Whenever I run ldap sync I get error 500. Login and everything else works just fine.
It works though in the ldap settings page but that is probably because it does not lookup the manager attribute.
I am running Active Directory on the other side of the ldap. I tested ldap and ldaps.
When running the ldap sync from cli I get this

Reproduction steps
1.Upgrade to php 7.4 2.Upgrade to snipe 6.0 3.Configure LDAP sync with manager attribue set (manager for AD) 4. Go to people tab or run command for ldap sync 5. See the error 500 or the one in the screenshot. 6. Leave manager field in ldap settings blank and it all works again ...
Expected behavior
Users sync and existing ones update with their manager field (other user object) from active directory.
Screenshots



Snipe-IT Version
v6.0.0 build 6860 (g722e88a47)
Operating System
Debian
Web Server
Apache
PHP Version
7.4
Operating System
Windows
Browser
Tested on Chrome and Firefox
Version
newest
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
No response
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
@Godmartinz - I think you donked around with some bits here - any help you can give?
Should I maybe rollback the update and run it with php 8.1 installed instead of 7.4? Which one is better tested?
I would stick with php 7.4
As for whether or not you roll back, that’s kinda your call. I’d love to track down the error in the sync script if we can and get it fixed before the end of the weekend, but I can’t guarantee that
And another question - if you remove the Manager attribute from the settings, do the LDAP syncs work out ok?
I would stick with php 7.4
As for whether or not you roll back, that’s kinda your call. I’d love to track down the error in the sync script if we can and get it fixed before the end of the weekend, but I can’t guarantee that
Well even if I upgrade php to 8.1 I dont think the error will be resolved, not really so you will still have your option to look into it.
And another question - if you remove the Manager attribute from the settings, do the LDAP syncs work out ok?
Yup, removing the manager attribute from settings makes the sync work again without an issue. I posted this in reproducing steps.
It might also help that I am running a lxc container from turnkeylinux.org but the update process I done manually since its pure debian under.
ok, I can replicate the bug and I'm working on a fix. I think it looks like it should be pretty easy?
As soon as we can get this merged, I'd love for you to give it another whirl if you can.
Sure, give me a ping in this thread to check on my end the problem is resolved.
Ok @jed214 - @snipe has merged my PR against master, can you pull down the latest and see if it fixes your problem?
Well yes it now syncs, but the Manager field is empty though after the sync even if its populated in Active Directory with a user that is also being synced to Snipe
Hrm. What setting are you using for the "LDAP Manager" field? I'm using manager there and it is correctly syncing AD managers - only if they actually exist in Snipe-IT though.
I am also using manager. It syncs but even on a user I created just now the field is empty when on AD its populated by my user that is in also synced to snipe

Hrm. What are you using for your Username field?

Before you ask I tried case sensitive
But then it does not work for and sync fails
Strange enough in the query field it works in the case sensitive form
Yeah, it's weird like that - in the query field, it wants the case-sensitive version, but in the username field, it wants all lower-case.
If the user actually exists in Snipe-IT, the manager should get set to that user. Are there any users that can get correctly set as manager? Like, maybe one in the Base DN level? Maybe one in a different OU? It's possible that that manager-setting logic needs to be improved.
Does the manager exist within that LDAP Filter?