[dev] Fix for LDAP protocol version setting in Prefs driver
Sergey
sergeyli at pisem.net
Tue Dec 17 11:36:58 PST 2002
Hi!
Here's a fix for Prefs/ldap.php driver to work correctly in case LDAP v3 only is allowed (OpenLDAP 2.1.x default config). It
also fixes errors stemming from using @ improperly: $this-> was used on a different variable, $conn, rather than $this->params
(!). That patch is against CVS source of 2002-11-11. The famous errors that were caused by not setting version are "Protocol
error" and "Stronger authentication required". One still needs "$conf['prefs']['params']['version'] = 3;" in horde/config/conf.php.
Using this chance and seeing that you're getting ready for the next release, I'd like to say that I'm thrilled with what Horde
and the gang of apps have to offer (good for users), and the code quality and style are always clean and clear (good for
developers). Thank you very much!
Sergey.
--- ldap.php-original 2002-12-17 11:23:23.000000000 -0500
+++ ldap.php 2002-12-13 13:24:17.000000000 -0500
@@ -147,6 +147,19 @@
return false;
}
+ /* Set the LDAP protocol version */
+ if (array_key_exists('version', $this->params)) {
+ if (!ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION,
+ $this->params['version'])) {
+ Horde::logMessage(
+ sprintf('Set LDAP protocol version to %d failed: [%d] %s',
+ $this->params['version'],
+ ldap_errno($this->connection),
+ ldap_error($this->connection)),
+ __FILE__, __LINE__);
+ }
+ }
+
/* Register our callback function to handle referrals. */
if (function_exists('ldap_set_rebind_proc') &&
!ldap_set_rebind_proc($conn, array($this, '_rebind_proc'))) {
@@ -159,12 +172,6 @@
return false;
}
- /* Set the LDAP protocol version */
- if (array_key_exists('version', $this->params)) {
- @ldap_set_option($this->conn, LDAP_OPT_PROTOCOL_VERSION,
- $params['version']);
- }
-
/* Define the DN of the current user */
$this->dn = sprintf('%s=%s,%s', $this->params['uid'],
$this->user,
More information about the dev
mailing list