From de3934ddb8532a3de7ed8061445273ee2dc35ee0 Mon Sep 17 00:00:00 2001
From: samucarc <samuel.carcases>
Date: Wed, 27 Mar 2019 15:18:37 +0100
Subject: [PATCH] Fixed function ldapsearch

Former-commit-id: 36678038a878673a3aae86ed014ee189775829db
---
 pandora_console/include/auth/mysql.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pandora_console/include/auth/mysql.php b/pandora_console/include/auth/mysql.php
index aab0b4c9e4..fc902ae1d8 100644
--- a/pandora_console/include/auth/mysql.php
+++ b/pandora_console/include/auth/mysql.php
@@ -1369,7 +1369,10 @@ function local_ldap_search($ldap_host, $ldap_port=389, $ldap_version=3, $dn, $ac
         $tls = ' -ZZ ';
     }
 
-    if (stripos($ldap_host, 'ldap') !== false) {
+    if (stripos($ldap_host, 'ldap://') !== false
+        || stripos($ldap_host, 'ldaps://') !== false
+        || stripos($ldap_host, 'ldapi://') !== false
+    ) {
         $ldap_host = ' -H '.$ldap_host.':'.$ldap_port;
     } else {
         $ldap_host = ' -h '.$ldap_host.' -p '.$ldap_port;