[Tickets #506] [PATCH] LDAP v3 Binds required
bugs at bugs.horde.org
bugs at bugs.horde.org
Thu Aug 26 14:16:28 PDT 2004
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=506
-----------------------------------------------------------------------
Ticket | 506
Updated By | ben at alkaloid.net
Summary | [PATCH] LDAP v3 Binds required
Queue | Passwd
Version | 2.2.1
State | Unconfirmed
Priority | 2. Medium
Type | Bug
Owners |
-----------------------------------------------------------------------
ben at alkaloid.net (2004-08-26 14:16) wrote:
Oops, I *hate* it when I mix patches together.
Please use this patch instead. It modifies backends.php.dist to include the
variable to set the LDAP protocol version and removes the references to the
strip_domain configuration (thats ticket number 507, oops). I also modified
the variable name so that it is a bit more clear which version we are
specifying.
----- snip passwd-ldapv3.diff -----
diff -urN passwd-2.2.1/config/backends.php.dist
passwd/config/backends.php.dist
--- passwd-2.2.1/config/backends.php.dist 2003-02-05
10:48:13.000000000 -0500
+++ passwd/config/backends.php.dist 2004-08-26 17:12:05.000000000 -0400
@@ -124,6 +124,7 @@
'host' => 'localhost',
'port' => 389,
'basedn' => 'o=example.com',
+ 'protocol_version' => 3,
'uid' => 'uid',
'realm' => '', // this will be appended to the username when
// looking for the userdn.
diff -urN passwd-2.2.1/lib/Driver/ldap.php passwd/lib/Driver/ldap.php
--- passwd-2.2.1/lib/Driver/ldap.php 2003-02-15 15:16:29.000000000 -0500
+++ passwd/lib/Driver/ldap.php 2004-08-26 17:13:00.000000000 -0400
@@ -34,6 +34,7 @@
$this->_params['basedn'] = array_key_exists('basedn', $params)
? $params['basedn'] : '';
$this->_params['realm'] = array_key_exists('realm', $params)
? $params['realm'] : '';
$this->_params['userdn'] = array_key_exists('userdn', $params)
? $params['userdn'] : null;
+ $this->_params['protocol_version'] =
array_key_exists('protocol_version', $params) ?
$params['protocol_version'] : null;
}
/**
@@ -47,6 +48,19 @@
*/
function _connect($userdn = null, $password = null) {
$this->_ds = ldap_connect($this->_params['host'],
$this->_params['port']);
+ /* Set the LDAP protocol version. */
+ if (array_key_exists('protocol_version', $this->_params)) {
+ if (!ldap_set_option($this->_ds, LDAP_OPT_PROTOCOL_VERSION,
+ $this->_params['protocol_version'])) {
+ Horde::logMessage(
+ sprintf('Set LDAP protocol version to %d failed: [%d]
%s',
+ $this->_params['protocol_version'],
+ ldap_errno($this->connection),
+ ldap_error($this->connection)),
+ __FILE__, __LINE__);
+ }
+ }
+
if (!$this->_ds) {
return PEAR::raiseError(_("Could not connect to ldap server"));
}
More information about the bugs
mailing list