Greg's Tech blog

WebCalendar & LDAP

Saturday 05 of November, 2005

Upon further review, I flipped the setting $set_ldap_version to true in user-ldap.php

Here are the rest of my settings

$ldap_server = 'localhost';          

// Port LDAP listens on (default 389)        
$ldap_port = '389';                   

// Use TLS for the connection (not the same as ldaps://)
$ldap_start_tls = false;

// If you need to set LDAP_OPT_PROTOCOL_VERSION
$set_ldap_version = true;
$ldap_version = '3'; // (usually 3)

// base DN to search for users      
$ldap_base_dn = 'ou=people,dc=gmartin,dc=org';

// The ldap attribute used to find a user (login). 
// E.g., if you use cn,  your login might be "Jane Smith"
//       if you use uid, your login might be "jsmith"
$ldap_login_attr = 'uid';

// Account used to bind to the server and search for information. 
// This user must have the correct rights to perform search.
// If left empty the search will be made in anonymous.
// *** We do NOT recommend storing the root LDAP account info here ***
$ldap_admin_dn = 'cn=search,ou=people,dc=gmartin,dc=org';  // user DN
$ldap_admin_pwd = 'Search'; // user password

//------ Admin Group Settings ------//
// A group name (complete DN) to find users with admin rights
$ldap_admin_group_name = 'cn=webcalAdmin,ou=groups,dc=gmartin,dc=org';

// What type of group do we want (posixgroup, groupofnames, groupofuniquenames)
$ldap_admin_group_type = 'groupOfUniqueNames';

// The LDAP attribute used to store member of a group
$ldap_admin_group_attr = 'uniqueMember';

//------ LDAP Search Settings ------//
// LDAP filter to find a user list.
$ldap_user_filter = '(objectclass=person)';

// Attributes to fetch from LDAP and corresponding user variables in the
// application. Do change according to your LDAP Schema
$ldap_user_attr = array( 
  // LDAP attribute   //WebCalendar variable
  'uid',              //login
  'sn',               //lastname
  'givenname',        //firstname
  'cn',               //fullname
  'mail'              //email

Finally got this to work with LDAP. The problem was that Webcal wasn't making the transition to LDAP V3. I had to add:

ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, '3');
after if ( $ds ) { in function user_valid_login()
and in connect_and_bind()

For some reason, the variable $ldap_version doesn't work