Code

Applied patch from ptitoliv closes #890
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 10:45:59 +0000 (10:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 10:45:59 +0000 (10:45 +0000)
-Allows to use tls in gosa setup.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@16524 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/setup/class_setupStep_Ldap.inc

index 03525da833329b87746a20781aef3dcd88181401..a57238e09c2f331ffbff7629865504de008f2720 100644 (file)
@@ -95,11 +95,18 @@ class Step_Ldap extends setup_step
     $this->connect_id = FALSE;
     $this->bind_id    = FALSE;
 
-    @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
-    $this->connect_id = @ldap_connect($this->connection);
+    ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
+    $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);