fix: the binding was not working on LDAP servers
That's going to break on any object found in a sub-tree, which was the point of using the DN instead, as that is the canonical path to the object we are binding as.
I think the attribute should actually be 'dn' instead of 'distinguishedname', but I think I tried that and it didn't work. I will test again.
Here is the content of the returned record on my setup:
cn: Benjamin Ziirish Sans uid: ziirish
Maybe I should build the dn line 92 instead?
Nope, that's because I'm and idiot and you didn't request the dn attribute to be returned. You should never need to construct a DN as it is the canonical name of the object. Every object in the repo has a unique DN, it's provided by the 'top' objectClass.
My stupidity was that I tried a search using 'dn=*' and it failed, so I took it to mean AD wasn't going to work with it and I should use distinguishedName instead. In fact, it should never work, as explained in this thread.
I'll commit the fix again.