Ticket #1484415: ldap_bind.diff

File ldap_bind.diff, 1.2 kB (added by coling, 18 months ago)

Patch to make the bind work with current user credentials

  • config/main.inc.php.dist

     
    189189// in order to enable public ldap search, create a config array 
    190190// like the Verisign example below. if you would like to test,  
    191191// simply uncomment the Verisign example. 
     192// 
     193// To use authenticated LDAP, simply fill in the bind_dn and bind_pass 
     194// values. You can use the wildcards %u and %p to use the currently 
     195// authenticated user's username and password. Obviously this means 
     196// you will run into problems if either credential literally contains 
     197// that sequence but this is not very likely :) 
    192198/**  
    193199 * example config for Verisign directory 
    194200 * 
  • program/include/rcube_ldap.inc

     
    110110  { 
    111111    if (!$this->conn) 
    112112      return false; 
    113      
     113 
     114    $dn = str_replace('%u', $_SESSION['username'], $dn); 
     115    $pass = str_replace('%p', decrypt_passwd($_SESSION['password']), $pass); 
     116 
    114117    if (@ldap_bind($this->conn, $dn, $pass)) 
    115118      return true; 
    116119    else