#21167 [Opn->Fbk]: ldapclose() SEGFAULTs
| From: | iliaa@php.net | Date: | Mon, 23 Dec 2002 18:07:27 +0000 |
| Subject: | #21167 [Opn->Fbk]: ldapclose() SEGFAULTs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28292@lists.php.net to get a copy of this message | ||
ID: 21167
Updated by: iliaa@php.net
Reported By: rsaura@retevision.es
-Status: Open
+Status: Feedback
Bug Type: Reproducible crash
Operating System: Linux Redhat 8.0
PHP Version: 4.2.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-12-23 12:06:48] rsaura@retevision.es
The following code will segfault with php-4.2.2 on RH-8.0
It queries a Microsoft Active Directory via LDAPv3.
It is suposed to create a session if a given user exists in the
directory, belongs to a given group and can bind to the directory with
the given password.
$ds=ldap_connect($LDAP_SERVER);
if($ds){
ldap_bind($ds, $QUERYUSER_DN, $QUERYUSER_PASS);
$err=ldap_errno($ds);
if($err==0){
$sr=ldap_search($ds, $BASE_DN, "samaccountname=rsaura",
array ("distinguishedName"), 0, 10000, 30, LDAP_DEREF_NEVER);
$entry = ldap_first_entry($ds, $sr);
if($entry == FALSE){
exit;
}
$attrs = ldap_get_attributes($ds, $entry);
$dn = $attrs["distinguishedName"][0];
$test=0;
$sr = ldap_search($ds, $BASE_DN, $GROUP_MEMBERSHIP,
array ("member"), 0, 10000, 30, LDAP_DEREF_NEVER);
$entry = ldap_first_entry($ds, $sr);
$attrs = ldap_get_attributes($ds, $entry);
foreach ($attrs["member"] as $user){
if($user==$dn){
$test=1;
break;
}
}
if($test==0){
exit;
}
ldap_close($ds); <---segfaults here!
} else {
exit;
}
} else {
exit;
}
$ds=ldap_connect($LDAP_SERVER);
if($ds){
ldap_bind($ds, $dn, $password);
$err=ldap_errno($ds);
if($err==0){
$loginok=1;
} else {
exit;
}
ldap_close($ds);
} else {
exit;
}
if($loginok == 1){
session_start();
session_register("loginok");
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21167&edit=1