<?xml version="1.0"?>
<?xml-stylesheet 
 href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"
?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel rdf:about="http://pear.php.net/bugs/4884/bug">
    <title>PEAR Bug #4884</title>
    <link>http://pear.php.net/bugs/4884</link>
    <description>[Closed] Fix for version 3 DB_ldap</description>
    <dc:language>en-us</dc:language>
    <dc:creator>pear-webmaster@lists.php.net</dc:creator>
    <dc:publisher>pear-webmaster@lists.php.net</dc:publisher>
    <admin:generatorAgent rdf:resource="http://pear.php.net/bugs"/>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    <items>
     <rdf:Seq>
      <rdf:li rdf:resource="http://pear.php.net/bugs/4884"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/4884/2008-03-24+16%3A43%3A01#2008-03-24+16%3A43%3A01"/>
      <rdf:li rdf:resource="http://pear.php.net/bugs/4884/2005-11-14+08%3A45%3A57#2005-11-14+08%3A45%3A57"/>
     </rdf:Seq>
    </items>
  </channel>
    <item rdf:about="http://pear.php.net/bugs/4884">
      <title>hamnis@... [2005-07-22 10:33:09]</title>
      <link>http://pear.php.net/bugs/4884</link>
      <description><![CDATA[<pre>DB_ldap Bug
Reported by hamnis@...
2005-07-22T14:33:09-00:00
PHP: 5.0.4 OS: Debian GNU/Linux sarge Package Version: 

Description:
------------
--- /usr/local/share/php/DB/ldap.php    2005-07-22 16:19:40.840020904 +0200
+++ ldap.php    2005-07-22 16:18:41.989967472 +0200
@@ -404,6 +404,7 @@
         $port  = $dsninfo['port'];
         $this-&gt;base = $dsninfo['database'];
         $this-&gt;d_base = $this-&gt;base;
+        $version = $dsninfo['protocol'];

         if (empty($host)) {
             return $this-&gt;raiseError(&quot;no host specified $host&quot;);
@@ -417,6 +418,9 @@
         if (!$conn) {
             return $this-&gt;raiseError(DB_ERROR_CONNECT_FAILED);
         }
+        if (isset($version)) {
+            ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, $version);
+        } else ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 2);
         if ($user &amp;&amp; $pw) {
             $bind = @ldap_bind($conn, $user, $pw);
         } else {


Test script:
---------------
before patch connecting to a openldap 2.2.27 server generates the following error:

$db = DB::connect($param);
if (PEAR::isError($db)) echo $db-&gt;getMessage();

gives: DB_ERROR -&gt; insufficient permissions

after patch:
The same code gives a DB_OK object.


Expected result:
----------------
DB_OK object

Actual result:
--------------
DB_ERROR object.</pre>]]></description>
      <content:encoded><![CDATA[<pre>DB_ldap Bug
Reported by hamnis@...
2005-07-22T14:33:09-00:00
PHP: 5.0.4 OS: Debian GNU/Linux sarge Package Version: 

Description:
------------
--- /usr/local/share/php/DB/ldap.php    2005-07-22 16:19:40.840020904 +0200
+++ ldap.php    2005-07-22 16:18:41.989967472 +0200
@@ -404,6 +404,7 @@
         $port  = $dsninfo['port'];
         $this-&gt;base = $dsninfo['database'];
         $this-&gt;d_base = $this-&gt;base;
+        $version = $dsninfo['protocol'];

         if (empty($host)) {
             return $this-&gt;raiseError(&quot;no host specified $host&quot;);
@@ -417,6 +418,9 @@
         if (!$conn) {
             return $this-&gt;raiseError(DB_ERROR_CONNECT_FAILED);
         }
+        if (isset($version)) {
+            ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, $version);
+        } else ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 2);
         if ($user &amp;&amp; $pw) {
             $bind = @ldap_bind($conn, $user, $pw);
         } else {


Test script:
---------------
before patch connecting to a openldap 2.2.27 server generates the following error:

$db = DB::connect($param);
if (PEAR::isError($db)) echo $db-&gt;getMessage();

gives: DB_ERROR -&gt; insufficient permissions

after patch:
The same code gives a DB_OK object.


Expected result:
----------------
DB_OK object

Actual result:
--------------
DB_ERROR object.</pre>]]></content:encoded>
      <dc:date>2005-07-22T14:33:09-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/4884/2008-03-24+16%3A43%3A01#2008-03-24+16%3A43%3A01">
      <title>dufuz [2008-03-24 21:43]</title>
      <link>http://pear.php.net/bugs/4884#1206394981</link>
      <description><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Now people can pass the LDAP version via protocal in the dsn array if no protocal is specified then DB_ldap will try to use v3 first and fallback on v2 if setting v3 fails.</pre>]]></description>
      <content:encoded><![CDATA[<pre>This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

Thank you for the report and for helping us make PEAR better.

Now people can pass the LDAP version via protocal in the dsn array if no protocal is specified then DB_ldap will try to use v3 first and fallback on v2 if setting v3 fails.</pre>]]></content:encoded>
      <dc:date>2008-03-24T21:43:01-00:00</dc:date>
    </item>
    <item rdf:about="http://pear.php.net/bugs/4884/2005-11-14+08%3A45%3A57#2005-11-14+08%3A45%3A57">
      <title>richter@... [2005-11-14 13:45]</title>
      <link>http://pear.php.net/bugs/4884#1131975957</link>
      <description><![CDATA[<pre>I second that.
DB_LDAP cannot connect() to a LDAP-Server (I tested on two OpenLDAP 2.2.23 servers) that does not have the &quot;allow bind_v2&quot; option set. Maybe protocol v3 should become the standard, as &quot;man slapd.conf&quot; says protocol v2 is &quot;Historic (RFC 3494)&quot;.

In addition to the method to set the protocol version implemented in the patch, I suggest to make connect() accept an options-array like the parent method DB:connect() does.

It should be documented that the protocol version can be set by adding an appropriate query string to the DSN URL. (It took me a long time to figure that out...)

Thanks for fixing this soon!</pre>]]></description>
      <content:encoded><![CDATA[<pre>I second that.
DB_LDAP cannot connect() to a LDAP-Server (I tested on two OpenLDAP 2.2.23 servers) that does not have the &quot;allow bind_v2&quot; option set. Maybe protocol v3 should become the standard, as &quot;man slapd.conf&quot; says protocol v2 is &quot;Historic (RFC 3494)&quot;.

In addition to the method to set the protocol version implemented in the patch, I suggest to make connect() accept an options-array like the parent method DB:connect() does.

It should be documented that the protocol version can be set by adding an appropriate query string to the DSN URL. (It took me a long time to figure that out...)

Thanks for fixing this soon!</pre>]]></content:encoded>
      <dc:date>2005-11-14T13:45:57-00:00</dc:date>
    </item>
</rdf:RDF>