Author Topic: roundcubemail-0.1-rc2 and Active directory  (Read 21259 times)

Offline Bcrosswize

  • Jr. Member
  • **
  • Posts: 10
roundcubemail-0.1-rc2 and Active directory
« on: February 05, 2008, 11:03:18 AM »
Hi everyone. Posting how I got RC and 2003 active directory working.

main.ini.php:
Code: [Select]
$rcmail_config['ldap_public']['That'] = array(
 'name'     => 'That School',
 'hosts'    => array('192.168.1.1'), // 2003 active directory server
 'port'     => 389, // 2003 active directory server port
 'base_dn'   => 'OU=That School,DC=thatschool,DC=k12,DC=state,DC=us', // base of orginazational unit
 'bind_dn'   => 'User', // 2003 active directory user to log on with
 'bind_pass'  => 'Pass', // 2003 active directory users password
 'ldap_version' => 3,   // using LDAPv3
 'search_fields' => array('sn', 'cn', 'givenName'), // fields to search in
 'name_field'  => 'cn',  // this field represents the contact's name
 'email_field' => 'mail', // this field represents the contact's e-mail
 'surname_field' => 'sn',  // this field represents the contact's last name
 'firstname_field' => 'givenName', // this field represents the contact's first name
 'scope'    => 'sub', // search mode: sub|base|list
 'filter'    => 'mail=*',   // used for basic listing (if not empty) and will be &'d with search queries. ex: (status=act)
 'fuzzy_search' => 0); // server allows wildcard search

rcube_ldap.inc
Make it sort by 'sn'
around line 234
Code: [Select]
// we have a search result resource
  if ($this->ldap_result && $this->result->count > 0)
  {
   if ($this->sort_col && $this->prop['scope'] !== "base")
     @ldap_sort($this->conn, $this->ldap_result, $this->sort_col);

     // Change 01/30/08 Sort Results - Start
     ldap_sort($this->conn, $this->ldap_result, "sn");
     // Change 01/30/08 Sort Results - End

Make search work
around line 294
Code: [Select]
// add general filter to querry
if (!empty($this->prop['filter']))
  // Change 01/30/08 Filter Query Correction
  //$filter = '(&'.$this->prop['filter'] . $filter . ')';
  $filter = '(&('.$this->prop['filter']. ')' . $filter . ')';


Offline Hhoodd

  • Newbie
  • *
  • Posts: 2
Re: roundcubemail-0.1-rc2 and Active directory
« Reply #1 on: April 07, 2008, 07:52:33 AM »
If we have multiply OU items, we should use base_dn "DC=thatschool,DC=k12,DC=state,DC=us" and "3268" globalcatalog AD port instead of "368"