ID:               21167
 Comment by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Feedback
 Bug Type:         Reproducible crash
 Operating System: Linux Redhat 8.0
 PHP Version:      4.2.2
 New Comment:

It works with php4-200212231630.

Does anybody know if this is patched on a production release?


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

[2002-12-23 12:07:27] [EMAIL PROTECTED]

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



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

[2002-12-23 12:06:48] [EMAIL PROTECTED]

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

Reply via email to