diff --git a/webui/config.php b/webui/config.php index d64cb65..5c290db 100644 --- a/webui/config.php +++ b/webui/config.php @@ -44,6 +44,13 @@ $config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'zimbraDistributionList'; $config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'zimbraMailForwardingAddress'; + +// AD specific settings +// +//$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'user'; +//$config['LDAP_DISTRIBUTIONLIST_OBJECTCLASS'] = 'group'; +//$config['LDAP_DISTRIBUTIONLIST_ATTR'] = 'member'; + // Lotus Notes specific settings for ldap authentication // //$config['LDAP_ACCOUNT_OBJECTCLASS'] = 'dominoPerson'; diff --git a/webui/model/user/auth.php b/webui/model/user/auth.php index b71e4ed..69e3917 100644 --- a/webui/model/user/auth.php +++ b/webui/model/user/auth.php @@ -66,7 +66,8 @@ $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))(&(objectClass=" . LDAP_DISTRIBUTIONLIST_OBJECTCLASS . ")(" . LDAP_DISTRIBUTIONLIST_ATTR . "=$username)" . "))", array()); + + $query = $ldap->query(LDAP_BASE_DN, "(&(objectClass=" . LDAP_ACCOUNT_OBJECTCLASS . ")(" . LDAP_MAIL_ATTR . "=$username))", array()); if(isset($query->row)) { $a = $query->row; @@ -76,6 +77,9 @@ if(ENABLE_SYSLOG == 1) { syslog(LOG_INFO, "ldap auth against '" . LDAP_HOST . "', dn: '" . $a['dn'] . "', result: " . $ldap_auth->is_bind_ok()); } if($ldap_auth->is_bind_ok()) { + + $query = $ldap->query(LDAP_BASE_DN, "(|(&(objectClass=" . LDAP_ACCOUNT_OBJECTCLASS . ")(" . LDAP_MAIL_ATTR . "=$username))(&(objectClass=" . LDAP_DISTRIBUTIONLIST_OBJECTCLASS . ")(" . LDAP_DISTRIBUTIONLIST_ATTR . "=$username)" . ")(&(objectClass=" . LDAP_DISTRIBUTIONLIST_OBJECTCLASS . ")(" . LDAP_DISTRIBUTIONLIST_ATTR . "=" . $a['dn'] . ")))", array()); + $emails = $this->get_email_array_from_ldap_attr($query->rows); $this->add_session_vars($a['cn'], $username, $emails); diff --git a/webui/system/database/ldap.php b/webui/system/database/ldap.php index 33e36f4..3b957a6 100644 --- a/webui/system/database/ldap.php +++ b/webui/system/database/ldap.php @@ -57,6 +57,7 @@ $query = new stdClass(); + $query->filter = $filter; $query->row = isset($data[0]) ? $data[0] : array(); $query->dn = isset($results[0]['dn']) ? $results[0]['dn'] : ""; $query->rows = $data;