index e831ec1055f6fbf57d52cfe65db249dcfea652a0..12454831bd3a0b71cd3cd43df001084f8ba2b80a 100644 (file)
var $rfc2307bis = FALSE;
var $attributes = array("connection","location","admin","password","base","admin_given","append_base_to_admin_dn","tls","rfc2307bis");
- var $header_image= "images/proxy.png";
+ var $header_image= "images/setup/ldap.png";
+ var $b_displayCheckbutton = TRUE;
function Step_Ldap()
{
$this->update_strings();
{
$smarty = get_smarty();
foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
+ $smarty->assign($attr,htmlentities($this->$attr,ENT_QUOTES,"UTF-8"));
}
/* Assign connection status */
$this->bind_id = FALSE;
@ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
- $this->connect_id = @ldap_connect($this->connection);
+ $this->connect_id = ldap_connect($this->connection);
- @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
- $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
+ if($this->tls){
+ if(@ldap_set_option($this->connect_id, LDAP_OPT_REFERRALS, 0))
+ if(@ldap_start_tls($this->connect_id))
+ $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
+ @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
+ }else{
+ @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
+ $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
+ }
if(!$this->bind_id){
$str = sprintf(_("Anonymous bind to server '%s' failed!"),$this->connection);
function resolve_user()
{
$filter = $this->resolve_filter;
- $ldap = new LDAP("","",$this->connection);
+
+ /* Establish ldap connection */
+ $cv = $this->parent->captured_values;
+ $ldap_l = new LDAP("","",$this->connection, FALSE, $this->tls);
+ $ldap = new ldapMultiplexer($ldap_l);
$ldap->cd($this->base);
$ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))");
$tmp = array();
while($attrs = $ldap->fetch()){
- $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']);
+ $tmp[base64_encode($attrs['dn'])]= LDAP::fix($attrs['dn']);
natcasesort($tmp);
}
return($tmp);
$reset = FALSE;
foreach($this->attributes as $attr){
if(isset($_POST[$attr])){
- if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){
+ if(in_array_strict($attr,array("base","connection")) && $this->$attr != get_post($attr)){
$reset = TRUE;
}
$this->$attr = get_post($attr);
if($reset){
$this->parent->disable_steps_from(($this->parent->step_name_to_id(get_class($this))) +1);
$attr = @LDAP::get_naming_contexts($this->connection);
- if(is_array($attr) && !in_array(get_post("base"),$attr)){
+ if(is_array($attr) && !in_array_strict(get_post("base"),$attr)){
if(isset($attr[0])){
$this->base = $attr[0];
}