From b41345c0479cdc821051983cc2019a1a4b69ed4d Mon Sep 17 00:00:00 2001
From: Olav Morken <olav.morken@uninett.no>
Date: Thu, 13 Mar 2008 11:38:45 +0000
Subject: [PATCH] LDAP: allow enable_tls for ldaps://-urls

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@407 44740490-163a-0410-bde0-09ae8108e29a
---
 lib/SimpleSAML/Auth/LDAP.php | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php
index 06d92926f..91cb29717 100644
--- a/lib/SimpleSAML/Auth/LDAP.php
+++ b/lib/SimpleSAML/Auth/LDAP.php
@@ -33,11 +33,11 @@ class SimpleSAML_Auth_LDAP {
 		
 		$this->setV3();
 		
-        if ($enable_tls) {
-            if (!@ldap_start_tls($this->ldap)) {
-                throw new Exception('Could not force LDAP into TLS-session. Please verify certificates and configuration. Could also be that PHP the LDAP library cannot connect to the LDAP server [' . $hostname . ']: ' . ldap_error($this->ldap) );
-            }
-        }
+		if (!preg_match("/ldaps:/i",$hostname) and $enable_tls) {
+			if (!@ldap_start_tls($this->ldap)) {
+				throw new Exception('Could not force LDAP into TLS-session. Please verify certificates and configuration. Could also be that PHP the LDAP library cannot connect to the LDAP server [' . $hostname . ']: ' . ldap_error($this->ldap) );
+			}
+		}
 
 	}
 	
-- 
GitLab