/**
* Tries to find a DN for a given kolab mail address.
*
* @param string $mail The mail address to search for.
*
* @return string The corresponding dn or false.
* @throws Horde_Group_Exception
*/
protected function _dnForMail($mail)
{
try {
$filter = Horde_Ldap_Filter::combine('and', array(Horde_Ldap_Filter::create('objectclass', 'equals', 'kolabInetOrgPerson'), Horde_Ldap_Filter::create('mail', 'equals', $mail)));
$search = $this->_ldap->search($this->_params['basedn'], $filter, array('dn'));
if ($search->count()) {
return $search->shiftEntry()->dn();
}
} catch (Horde_Ldap_Exception $e) {
throw new Horde_Group_Exception($e);
}
throw new Horde_Group_Exception(sprintf('Error searching for user with the email address "%s"', $mail));
}