Code

Applied tls patch
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 10:51:05 +0000 (10:51 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 10:51:05 +0000 (10:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16526 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/setup/class_setupStep_Ldap.inc

index 03525da833329b87746a20781aef3dcd88181401..eca54c38a809806ade702a4075aba2d716336055 100644 (file)
@@ -96,10 +96,17 @@ class Step_Ldap extends setup_step
     $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);