php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42105 CLI binary segfaults on ldap_bind(), Apache module works fine
Submitted: 2007-07-25 16:19 UTC Modified: 2009-08-07 19:41 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: paul at moonkhan dot org Assigned:
Status: Not a bug Package: CGI/CLI related
PHP Version: 5.2CVS-2007-07-26 OS: RHEL4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: paul at moonkhan dot org
New email:
PHP Version: OS:

 

 [2007-07-25 16:19 UTC] paul at moonkhan dot org
Description:
------------
ldap_bind(), whether anonymous or not, produces a Segfault when run from 
the command line. This is occurring on 5.2.3 (and I can reproduce it on 
5.2.1). Please note that 5.1.6 does not have this problem.

Reproduce code:
---------------
$ds = ldap_connect("ldaps://ldap.example.com");

if($ds) {
  echo "Connected\n";

  // Anonymous bind
  $br = ldap_bind($ds);

  // Use this for authenticated binds
  //$br = ldap_bind($ds, $argv[1], $argv[2]);

  echo "Bind result: $br\n";
}



Expected result:
----------------
Connected
Bind result: 1





Actual result:
--------------
Connected
Bind result: 1
Segmentation fault

Backtrace:

(gdb) bt
#0  0x005c5140 in ASN1_primitive_free () from /lib/libcrypto.so.4
#1  0x005c518a in ASN1_primitive_free () from /lib/libcrypto.so.4
#2  0x005c521d in ASN1_primitive_free () from /lib/libcrypto.so.4
#3  0x005c545d in ASN1_template_free () from /lib/libcrypto.so.4
#4  0x005c5383 in ASN1_primitive_free () from /lib/libcrypto.so.4
#5  0x005c545d in ASN1_template_free () from /lib/libcrypto.so.4
#6  0x005c5383 in ASN1_primitive_free () from /lib/libcrypto.so.4
#7  0x005c5493 in ASN1_item_free () from /lib/libcrypto.so.4
#8  0x005c05d1 in X509_free () from /lib/libcrypto.so.4
#9  0x003e9712 in ssl_sess_cert_free () from /lib/libssl.so.4
#10 0x003ea4b9 in SSL_SESSION_free () from /lib/libssl.so.4
#11 0x003e825b in SSL_free () from /lib/libssl.so.4
#12 0x00a57b13 in ldap_pvt_tls_init () from /usr/lib/libldap-2.2.so.7
#13 0x002f5726 in ber_sockbuf_remove_io () from /usr/lib/liblber-
2.2.so.7
#14 0x002f57d6 in ber_int_sb_destroy () from /usr/lib/liblber-2.2.so.7
#15 0x002f586d in ber_sockbuf_free () from /usr/lib/liblber-2.2.so.7
#16 0x00a418e8 in ldap_ld_free () from /usr/lib/libldap-2.2.so.7
#17 0x00a41b16 in ldap_unbind_ext () from /usr/lib/libldap-2.2.so.7
#18 0x00a41c60 in ldap_unbind_s () from /usr/lib/libldap-2.2.so.7
#19 0x0812099f in _close_ldap_link (rsrc=0xb7fab080) at /usr/src/php-
5.2.3/ext/ldap/ldap.c:200
#20 0x08290781 in list_entry_destructor (ptr=0xb7fab080) at 
/usr/src/php-5.2.3/Zend/zend_list.c:184
#21 0x0828e409 in zend_hash_del_key_or_index (ht=0x84066e0, arKey=0x0, 
nKeyLength=0, h=4, flag=1)
    at /usr/src/php-5.2.3/Zend/zend_hash.c:497
#22 0x0829051c in _zend_list_delete (id=4) at /usr/src/php-
5.2.3/Zend/zend_list.c:58
#23 0x08279799 in _zval_ptr_dtor (zval_ptr=0xb7faa128) at 
/usr/src/php-5.2.3/Zend/zend_variables.h:35
#24 0x0828f750 in zend_hash_apply_deleter (ht=0x8406650, p=0xb7faa11c) 
at /usr/src/php-5.2.3/Zend/zend_hash.c:611
#25 0x0828f7eb in zend_hash_graceful_reverse_destroy (ht=0x8406650) at 
/usr/src/php-5.2.3/Zend/zend_hash.c:646
#26 0x08279dfa in shutdown_executor () at /usr/src/php-
5.2.3/Zend/zend_execute_API.c:239
#27 0x08286354 in zend_deactivate () at /usr/src/php-
5.2.3/Zend/zend.c:860
#28 0x0824f058 in php_request_shutdown (dummy=0x0) at /usr/src/php-
5.2.3/main/main.c:1317
#29 0x08300b5f in main (argc=2, argv=0xbfe04c74) at /usr/src/php-
5.2.3/sapi/cli/php_cli.c:1319





Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-26 14:09 UTC] paul at moonkhan dot org
The CVS snapshot didn't fix the segfaulting when using the command line binary.
 [2007-07-26 15:29 UTC] jani@php.net
What was the full configure line used? (check from CLI php with -i option :)
 [2007-07-26 15:38 UTC] paul at moonkhan dot org
Here is the configure line:

Configure Command =>  './configure'  '--with-apxs2=/usr/local/httpd-2.2.4/bin/apxs' '--prefix=/usr/local/php-5.2.1' '--sysconfdir=/usr/local/etc/php' '--with-config-file-path=/usr/local/etc/php' '--with-gd' '--with-zlib-dir=/usr' '--with-jpeg-dir=/usr' '--with-ldap' '--with-mcrypt' '--with-mhash' '--with-curl' '--with-openssl' '--with-xsl' '--with-libxml' '--with-pear=/usr/local/pear' '--with-mysql' '--with-oci8=instantclient,/usr/src/instantclient_10_2' '--with-sigchild' '--with-custom-odbc=/usr/local/odbc32v52' '--with-ttf' '--with-freetype-dir=/usr'

Just ignore the weird --prefix - I had no intention of doing a make install on this compile :)  Also, on the snapshot configure, it mentioned that --with-libxml and --with-sigchild are not real options anymore but I just left them in there anyways.

Thanks,

-Paul
 [2007-07-26 17:26 UTC] jani@php.net
Those two options configure said are unknown have actually never existed. The correct ones are "--enable-libxml" and "--enable-sigchild".
I'll try with your configure line and try to reproduce this.
 [2007-08-01 10:52 UTC] jani@php.net
Is it possible to provide me access to such server using SSL..? I don't know any and I really don't have time to setup one myself..
 [2007-08-07 15:47 UTC] jani@php.net
I could not reproduce and the issue seems to be in the ldap or ssl libs anyway. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC