From d9f45f5406bd1b3bddfde09b619d637584645ae2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come@opensides.be>
Date: Mon, 30 Apr 2018 15:37:37 +0200
Subject: [PATCH] :ambulance: fix(ldap) Use STARTTLS in LDIF export if needed

When STARTTLS is on it config file it should also be used for LDIF
 export.

issue #5824
---
 include/class_ldap.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index bf5db49ea..7c218cb3d 100644
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
@@ -952,7 +952,7 @@ class LDAP
     $admin  = escapeshellarg($this->binddn);
     $filter = escapeshellarg($filter);
 
-    $cmd = "ldapsearch -x -LLLL -D {$admin} {$filter} {$limit} {$scope} -H {$host} -b {$dn} -w {$pwd} ";
+    $cmd = 'ldapsearch'.($this->tls ? ' -ZZ' : '')." -x -LLLL -D {$admin} {$filter} {$limit} {$scope} -H {$host} -b {$dn} -w {$pwd} ";
 
     // Create list of process pipes
     $descriptorspec = array(
-- 
GitLab