From: rolli at aum dot unibe dot ch
Operating system: Linux-2.4
PHP version: 4.3.3
PHP Bug Type: LDAP related
Bug description: ldap_bind produces an assertion error in cyrus.c

Description:
------------
When using ldap_bind() nothing happens as script execution stops
immediatly. Verifying the script with CLI there's an assertion error in
cyrus.c
The problem seems to be related to cyrus.c working with a
cyrus-sasl-2.1x.

Checked the following:
Server 1: php-4.3.3 with cyrus-sasl-1.5.24 works
Server 2: php-4.3.3 with cyrus-sasl2-2.1.12 doesn't work

Both Servers compiled wiht:
'./configure' '--prefix=/usr/share' '--datadir=/usr/share/php'
'--bindir=/usr/bin' '--libdir=/usr/share' '--includedir=/usr/include'
'--with-_lib=lib' '--with-config-file-path=/etc'
'--with-exec-dir=/usr/lib/php/bin' '--disable-debug' '--enable-bcmath'
'--enable-calendar' '--enable-ctype' '--enable-dbase'
'--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-ftp'
'--enable-gd-imgstrttf' '--enable-gd-native-ttf'
'--enable-inline-optimization' '--enable-magic-quotes'
'--enable-mbstr-enc-trans' '--enable-mbstring' '--enable-mbregex'
'--enable-memory-limit' '--enable-safe-mode' '--enable-shmop'
'--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm'
'--enable-track-vars' '--enable-trans-sid' '--enable-versioning'
'--enable-wddx' '--enable-yp' '--with-bz2' '--with-curl'
'--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm'
'--with-gettext' '--with-gmp' '--with-imap=yes' '--with-imap-ssl'
'--with-imagick=/usr' '--with-openssl' '--with-iodbc'
'--with-java=/usr/lib/SunJava2-1.4.1' '--with-jpeg-dir=/usr'
'--with-ldap=yes' '--with-mcal=/usr' '--with-mcrypt'
'--with-mnogosearch=/usr/local/mnogosearch' '--with-mysql=/usr'
'--with-ndbm' '--with-pgsql=shared' '--with-png-dir=/usr'
'--with-readline' '--with-snmp' '--with-t1lib' '--with-tiff-dir=/usr'
'--with-ttf' '--with-freetype-dir=yes' '--with-xml' '--with-xmlrpc'
'--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xpm-dir=/usr/X11R6'
'--with-zlib=yes' '--with-gd' '--enable-xslt' '--with-xslt-sablot'
'--with-iconv' '--with-mm' '--with-pdflib=/usr'
'--with-apxs=/usr/sbin/apxs'

Reproduce code:
---------------
<?php
error_reporting(E_ALL);
echo "Connecting ...";
$ldapconn=ldap_connect("ldaps://id-auth01.unibe.ch,
ldaps://id-auth02.unibe.ch","636");
if (is_resource($ldapconn)) {
echo "Binding ...";
$ldapbind = ldap_bind($ldapconn);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
ldap_close($ldapconn);
?>

Expected result:
----------------
I should see a pretty "LDAP bind successful". Acutally works on Server 1
with cyrus-sasl-1.5.24.

Actual result:
--------------
#mrlinux: php ldap.php
php: cyrus.c:469: ldap_int_sasl_open: Assertion `lc->lconn_sasl_ctx ==
((void *)0)' failed.
Aborted

Then tested with above script and only one ldap-server in ldap_connect()
leads to
Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server
in
on Server 2, but works perfectly on Server 1.

So could it be ext/cyrus not compatible with cyrus-sasl2-2.1.12?

--
Edit bug report at [url]http://bugs.php.net/?id=25454&edit=1[/url]
--
Try a CVS snapshot (php4): [url]http://bugs.php.net/fix.php?id=25454&r=trysnapshot4[/url]
Try a CVS snapshot (php5): [url]http://bugs.php.net/fix.php?id=25454&r=trysnapshot5[/url]
Fixed in CVS: [url]http://bugs.php.net/fix.php?id=25454&r=fixedcvs[/url]
Fixed in release: [url]http://bugs.php.net/fix.php?id=25454&r=alreadyfixed[/url]
Need backtrace: [url]http://bugs.php.net/fix.php?id=25454&r=needtrace[/url]
Try newer version: [url]http://bugs.php.net/fix.php?id=25454&r=oldversion[/url]
Not developer issue: [url]http://bugs.php.net/fix.php?id=25454&r=support[/url]
Expected behavior: [url]http://bugs.php.net/fix.php?id=25454&r=notwrong[/url]
Not enough info: [url]http://bugs.php.net/fix.php?id=25454&r=notenoughinfo[/url]
Submitted twice: [url]http://bugs.php.net/fix.php?id=25454&r=submittedtwice[/url]
register_globals: [url]http://bugs.php.net/fix.php?id=25454&r=globals[/url]
PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=25454&r=php3[/url]
Daylight Savings: [url]http://bugs.php.net/fix.php?id=25454&r=dst[/url]
IIS Stability: [url]http://bugs.php.net/fix.php?id=25454&r=isapi[/url]
Install GNU Sed: [url]http://bugs.php.net/fix.php?id=25454&r=gnused[/url]