php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19281 OpenLDAP 2.1.4 requires version
Submitted: 2002-09-07 10:37 UTC Modified: 2002-09-09 09:34 UTC
From: mose at ns dot cune dot edu Assigned:
Status: Not a bug Package: LDAP related
PHP Version: 4CVS-2002-09-07 OS: RH 7.3, 2.4.19
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mose at ns dot cune dot edu
New email:
PHP Version: OS:

 

 [2002-09-07 10:37 UTC] mose at ns dot cune dot edu
imap-2002.RC5
Apache 2.0.40
mysql 3.23.49
openldap 2.1.4

configure --with-apxs2=/local/apache/bin/apxs --enable-force-cgi-redirect --disable-cli --with-imap=/home/mose/imap-2002.RC5 --with-ldap --with-mysql=/local/mysql

It appears that since version 2.1.3 of openldap, it requires that the LDAP version be set to 3 when making a connection.  The php routines do not set the version.  The following lines inserted in ext/ldap/ldap.c in the function ldap_connect() seem to work for me.

    int version;

and then inside #ifdef LDAP_API_FEATURE_X_OPENLDAP

                ldap = ldap_init(host, port);
        }
    version = LDAP_VERSION3;
    (void)ldap_set_option (ldap, LDAP_OPT_PROTOCOL_VERSION, &version);
#else

Everyone should probably be using version 3.  However, you may want to allow the version to be specified at configuration time or allow the version to be specified in php with the ldap_connect() call, with a default of version 3.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-09 01:44 UTC] venaas@php.net
I see your reasoning, but I'm opposed to this change. PHP
always defaulted to v2 since the LDAP library did, and if
one used v3 server one had to set the version. To use v3
do as follows before binding:

ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
 [2002-09-09 05:03 UTC] sniper@php.net
Not a bug..

 [2002-09-09 09:31 UTC] mose at ns dot cune dot edu
Your decision violates the law of least surprise.  Allowing a default version to be specified at compile time would be the more prudent option.  Otherwise a lot of PHP software using LDAP will break when OpenLDAP and PHP are upgraded.
 [2002-09-09 09:34 UTC] derick@php.net
Only when ldap is updated... not when PHP is updated alone.

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC