php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13870 LDAP_ADD crashes apache
Submitted: 2001-10-30 07:56 UTC Modified: 2001-11-05 07:24 UTC
From: jejo at cybercity dot dk Assigned:
Status: Closed Package: LDAP related
PHP Version: 4.0.6 OS: FreeBSD 4.4-RELEASE
Private report: No CVE-ID: None
 [2001-10-30 07:56 UTC] jejo at cybercity dot dk
Installed versions of relatede software:

- openldap-2.0.17
- apache_1.3.22
- php-4.0.6

The script that can produce the error. This of cause requires a working LDAP server (and this is confirmed in this setup)

<?
$ds=ldap_connect("172.16.2.37"); 
$r=ldap_bind($ds, "cn=Manager,dc=test,dc=dk", "secret");     
$info["cn"]["bbb34783a"]="hejsa";
$mod=ldap_add($ds,"uid=bbb34783,ou=people,dc=test,dc=dk",$info);     
?>

The error in apache error-log are:

assertion "str != NULL" failed: file "encode.c", line 283
[Tue Oct 30 11:58:53 2001] [notice] child pid 31369 exit signal Abort trap (6)

and the backtrace gives:

(gdb) bt
#0  0x2829b764 in kill () from /usr/lib/libc.so.4
#1  0x282d77b6 in abort () from /usr/lib/libc.so.4
#2  0x282b44ef in __assert () from /usr/lib/libc.so.4
#3  0x28225605 in ber_put_ostring () from /usr/local/lib/liblber.so.2
#4  0x2822572b in ber_put_berval () from /usr/local/lib/liblber.so.2
#5  0x28226476 in ber_printf () from /usr/local/lib/liblber.so.2
#6  0x28209985 in ldap_add_ext () from /usr/local/lib/libldap.so.2
#7  0x28209a5c in ldap_add_ext_s () from /usr/local/lib/libldap.so.2
#8  0x28209ac4 in ldap_add_s () from /usr/local/lib/libldap.so.2
#9  0x8087bba in php_if_ldap_dn2ufn ()
#10 0x8087dcf in php_if_ldap_add ()
#11 0x814f41e in execute ()
#12 0x81141b8 in zend_execute_scripts ()
#13 0x807e3f7 in php_execute_script ()
#14 0x8124d8e in apache_php_module_main ()
#15 0x807b106 in php_restore_umask ()
#16 0x807b13e in php_restore_umask ()
#17 0x8159d71 in ap_invoke_handler ()
#18 0x816e6a8 in ap_some_auth_required ()
#19 0x816e712 in ap_process_request ()
#20 0x816567f in ap_child_terminate ()
#21 0x8165841 in ap_child_terminate ()
#22 0x81659ba in ap_child_terminate ()

Do let me know if I can provide more information that will help out?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-05 04:07 UTC] venaas@php.net
This should be fixed, but not sure what behavior would
be the best. The problem is that you need to start with
index 0 and use numeric indices. I don't see any reason
for doing $info["cn"]["bbb34783a"]="hejsa";
Why don't you just do $info["cn"]="hejsa";
I usually like to do as follows with multiple values:

$info["cn"][]="a";
$info["cn"][]="b";
$info["cn"][]="c";

We could make it work with any index, or we could ignore
or give error when indices are not 0, 1, ..., n. But
which is the best...

 [2001-11-05 06:59 UTC] venaas@php.net
I now made it give a warning and return FALSE. Think it
was important to fix it, since it also could add the
wrong value and not give any form of error. I'm closing
this, since I think it's good enough solution.
 [2001-11-05 07:24 UTC] jejo at cybercity dot dk
Thank you very much ,Im happy :o)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 21:01:29 2024 UTC