diff --git a/lib/SimpleSAML/Auth/LDAP.php b/lib/SimpleSAML/Auth/LDAP.php index 06d92926f49faa34a80f6dc91ee4a3ec8403c08a..91cb29717636b8f11462abec73ebf095f7761484 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) ); + } + } }