Page 1 of 1

LDAP

Posted: 2013-12-13, 11:20
by Suffer1981de
Hi,

I had a few Problems figuring out, how ldap authentication is supposed to work in 3.6010.

I had ldap running in 3.3.004, using changes in tclogin.class.php. In 3.6010 this file wasn't existent and I could see any change, which proposed this change. LDAP Error 95: Username unknown (no uid found) (German: Benutzername unbekannt)

Now I found the same Informations in models\login_model.php

So I'm writing this little How-To, for people using an Microsoft AD (Samba 4)

Make Changes to models\login_model.php:

Code: Select all

// Search uid entry
         if (!$info = ldap_first_entry($ds, ldap_search($ds, $searchbase, "uid=".$this->U->username, $attr))) return 95;
         // Use this statement instead of previous when binding to Active Directory
         // if (!$info = ldap_first_entry($ds, ldap_search($ds, $searchbase, "sAMAccountName=".$this->U->username, $attr))) return 95;
If you use an Active Directory comment the first if statement out (// in front) and decomment the second if statement (remove the //).

It should look like this:

Code: Select all

// Search uid entry
         // if (!$info = ldap_first_entry($ds, ldap_search($ds, $searchbase, "uid=".$this->U->username, $attr))) return 95;
         // Use this statement instead of previous when binding to Active Directory
         if (!$info = ldap_first_entry($ds, ldap_search($ds, $searchbase, "sAMAccountName=".$this->U->username, $attr))) return 95;
I think this little piece of Information should be included in the manual.

Best Regards

Marc