summaryrefslogtreecommitdiff
path: root/lib/Auth/LDAP.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Auth/LDAP.php')
-rw-r--r--lib/Auth/LDAP.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 60a870c..15b3057 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -243,6 +243,35 @@ class LDAP extends Net_LDAP3 {
}
+ public function find_recipient($address)
+ {
+ $this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw);
+
+ $mail_attrs = $this->conf->get_list('mail_attributes', array('mail', 'alias'));
+
+ $search = array(
+ 'params' => array(
+ 'type' => 'exact'
+ ),
+ 'operator' => "OR"
+ );
+
+ foreach ($mail_attrs as $num => $attr) {
+ $search['params'][$attr] = array(
+ 'type' => 'exact',
+ 'value' => $address,
+ );
+ }
+
+ $result = $this->search_entries($this->config_get('root_dn'), '(objectclass=*)', 'sub', null, $search);
+
+ if ($result->count() > 0) {
+ return $result->entries(TRUE);
+ } else {
+ return FALSE;
+ }
+ }
+
public function get_attributes($subject_dn, $attributes)
{
$this->_log(LOG_DEBUG, "Auth::LDAP::get_attributes() for $subject_dn");