Changeset 2157 in subversion
- Timestamp:
- Dec 16, 2008 10:28:07 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/rcube_ldap.php
r2127 r2157 69 69 function connect() 70 70 { 71 global $RCMAIL; 72 71 73 if (!function_exists('ldap_connect')) 72 74 raise_error(array('type' => 'ldap', 'message' => "No ldap support in this installation of PHP"), true); … … 100 102 $this->ready = true; 101 103 104 // User specific access, generate the proper values to use. 102 105 if ($this->prop["user_specific"]) { 103 // User specific access, generate the proper values to use. 104 global $CONFIG, $RCMAIL; 106 // No password set, use the session password 105 107 if (empty($this->prop['bind_pass'])) { 106 // No password set, use the users.107 108 $this->prop['bind_pass'] = $RCMAIL->decrypt_passwd($_SESSION["password"]); 108 } // end if109 } 109 110 110 111 // Get the pieces needed for variable replacement. 111 // See if the logged in username has an "@" in it. 112 if (is_bool(strstr($_SESSION["username"], "@"))) { 113 // It does not, use the global default. 114 $fu = $_SESSION["username"]."@".$CONFIG["username_domain"]; 115 $u = $_SESSION["username"]; 116 $d = $CONFIG["username_domain"]; 117 } // end if 118 else { 119 // It does. 120 $fu = $_SESSION["username"]; 121 // Get the pieces needed for username and domain. 122 list($u, $d) = explode("@", $_SESSION["username"]); 123 } # end else 124 125 // Replace the bind_dn variables. 126 $bind_dn = str_replace(array("%fu", "%u", "%d"), 127 array($fu, $u, $d), 128 $this->prop['bind_dn']); 129 $this->prop['bind_dn'] = $bind_dn; 130 // Replace the base_dn variables. 131 $base_dn = str_replace(array("%fu", "%u", "%d"), 132 array($fu, $u, $d), 133 $this->prop['base_dn']); 134 $this->prop['base_dn'] = $base_dn; 135 136 $this->ready = $this->bind($this->prop['bind_dn'], $this->prop['bind_pass']); 137 } // end if 138 elseif (!empty($this->prop['bind_dn']) && !empty($this->prop['bind_pass'])) 112 $fu = $RCMAIL->user->get_username(); 113 list($u, $d) = explode('@', $fu); 114 115 // Replace the bind_dn and base_dn variables. 116 $replaces = array('%fu' => $fu, '%u' => $u, '%d' => $d); 117 $this->prop['bind_dn'] = strtr($this->prop['bind_dn'], $replaces); 118 $this->prop['base_dn'] = strtr($this->prop['base_dn'], $replaces); 119 } 120 121 if (!empty($this->prop['bind_dn']) && !empty($this->prop['bind_pass'])) 139 122 $this->ready = $this->bind($this->prop['bind_dn'], $this->prop['bind_pass']); 140 123 }
Note: See TracChangeset
for help on using the changeset viewer.
