Bug #13870 Updated: LDAP_ADD crashes apache

From: Date: Mon, 05 Nov 2001 11:59:05 +0000
Subject: Bug #13870 Updated: LDAP_ADD crashes apache
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-69639@lists.php.net to get a copy of this message
ID: 13870
Updated by: venaas
Reported By: jejo@cybercity.dk
Old Status: Open
Status: Closed
Bug Type: LDAP related
Operating System: FreeBSD 4.4-RELEASE
PHP Version: 4.0.6
New Comment:

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.

Previous Comments:
------------------------------------------------------------------------

[2001-11-05 04:07:20] 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-10-30 07:56:59] jejo@cybercity.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?



------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13870&edit=1



Thread (4 messages)

« previous php.dev (#69639) next »