Fallback Auth doesnt work for LDAP/AD

Issue #80 resolved
Karsten Bandlow created an issue

Fallback Auth fails because in /system/database/Ldap.php returns a empty array. But we need null. Because a if isset statement in auth.php returns true.

This patch file was generated by NetBeans IDE

It uses platform neutral UTF-8 encoding and \n newlines.

--- HEAD +++ Modified In Working Tree @@ -57,7 +57,7 @@

   $query = new stdClass();
  • $query->row = isset($data[0]) ? $data[0] : array();
  • $query->row = isset($data[0]) ? $data[0] : null; $query->dn = isset($results[0]['dn']) ? $results[0]['dn'] : ""; $query->rows = $data; $query->num_rows = $results['count'];

Comments (9)

  1. Janos SUTO repo owner

    ok, but I was interested in where does it hurt in model/user/auth.php that we get an empty array instead of null? Why does the fallback auth fail?

  2. Karsten Bandlow reporter

    Hi Jsutu, because you return an empty array, and the check in checkLoginAgainstLDAP (/model/user/auth.php) is a if Statement if isset $query->row. But is empty, so I prefer to return null.

    private function checkLoginAgainstLDAP($username = '', $password = '') {

       $ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
    
       if($ldap->is_bind_ok()) {
    
          $query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=" .
    

    LDAP_ACCOUNT_OBJECTCLASS . ")(" . LDAP_MAIL_ATTR . "=$username))", array());

    if(isset($query->row)) { <----------here is the problem

    or check is empty

    Karsten

    Am 17.04.2013 23:16, schrieb jsuto:

  3. Log in to comment