| 1 |
<?php |
<?php |
| 2 |
// $Id: LDAPInterface.php,v 1.10 2007/08/23 00:05:42 kreaper Exp $ |
// $Id: LDAPInterface.php,v 1.2.2.6.2.3 2008/04/17 04:32:13 scafmac Exp $ |
| 3 |
|
|
| 4 |
class LDAPInterface { |
class LDAPInterface { |
| 5 |
|
|
| 106 |
|
|
| 107 |
function initConnection() { |
function initConnection() { |
| 108 |
if (!$con = ldap_connect($this->server, $this->port)) { |
if (!$con = ldap_connect($this->server, $this->port)) { |
| 109 |
watchdog('user', 'LDAP Connect failure to ' . $this->server . ':' . $this->port); |
watchdog('user', t('LDAP Connect failure to @server:@port.', array('@server' => $this->server, '@port' => $this->port))); |
| 110 |
return NULL; |
return NULL; |
| 111 |
} |
} |
| 112 |
|
|
| 117 |
if ($this->tls) { |
if ($this->tls) { |
| 118 |
$vers = $this->getOption('version'); |
$vers = $this->getOption('version'); |
| 119 |
if ($vers == -1) { |
if ($vers == -1) { |
| 120 |
watchdog('user', 'Could not get LDAP protocol version.'); |
watchdog('user', t('Could not get LDAP protocol version.')); |
| 121 |
} |
} |
|
|
|
| 122 |
if ($vers != 3) { |
if ($vers != 3) { |
| 123 |
watchdog('user', 'Could not start TLS, only supported by LDAP v3.'); |
watchdog('user', t('Could not start TLS, only supported by LDAP v3.')); |
| 124 |
} |
} |
| 125 |
else if (!function_exists('ldap_start_tls')) { |
else if (!function_exists('ldap_start_tls')) { |
| 126 |
watchdog('user', 'Could not start TLS. It does not seem to be supported by this PHP setup.'); |
watchdog('user', t('Could not start TLS. It does not seem to be supported by this PHP setup.')); |
| 127 |
} |
} |
| 128 |
else if (!ldap_start_tls($con)) { |
else if (!ldap_start_tls($con)) { |
| 129 |
watchdog('user', t("Could not start TLS. (Error %errno: %error).", array('%errno' => ldap_errno($con), '%error' => ldap_error($con)))); |
watchdog('user', t("Could not start TLS. (Error %errno: %error).", array('%errno' => ldap_errno($con), '%error' => ldap_error($con)))); |