I noticed a bug in the LDAP authentication code. We are trying to set the users idnumber field as the dn for the user.
However, in the function 'auth_get_userinfo()' there is a bug. For our LDAP entry, since the dn is not entered as an array, it only grabs the first character of the string entry resulting in the idnumber field getting set to 'u' for everyone. A simple is_array solves the problem. Attached is a diff file (from MOODLE_15_STABLE) for lib.php in '$CFG->dirroot/auth/ldap'
Could somebody please review this and patch in CVS? It is tested and working for us. I would do it myself, but I'm not sure what etiquette says for editing code done by others unless you are one of the core developers.
Hi Jeff - well done on finding the cause! - I had a discussion with Martin Langhoff a while back with this issue, but we didn't end up finding the actual cause - I'm running a hack in our version that works, but your solution looks much cleaner!
No we aren't, at least in 1.5.
Looking at the field length in the db had me a little worried, but fortunately our entries are rather short. I think the longest possible one we would have is 39 characters (less than the 64 limit). However, I think that field should be expanded for general purpose as more people are probably going to begin using LDAP and it makes sense that the user dn would be the idnumber which could be rather long depending on the schema used.
did you increase the length of idnumber too?