From:             bugs dot php dot net at phrenetic dot to
Operating system: RedHat 7.1
PHP version:      4.3.3
PHP Bug Type:     LDAP related
Bug description:  Unable to handle Active Directory referals (W2k3)

Description:
------------
Recently at my site they started to upgrade some directory servers and
suddenly stuff started to break. All of them PHP'ish. All LDAP searches
broke with "Operations Error". Doing the same queries with ldapsearch
(openldap commandline tool) everything looked fine except that I could
imagine something going on with the result as I got 'ref:
ldap://foo.bar.com/ou=foo,o=bar' back in the chunk coming from the
server.

I found a 2-year old workaround for it here: (Surprisingly works
flawless.)
http://groups.google.se/groups?q=LDAP_OPT_REFERRALS+%2Bfollow+referrals&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=20011226190121.22738.qmail%40php2.chek.com&rnum=1



Reproduce code:
---------------
        foreach($ldaphosts as $ldaphost)
        {
                if( !$fail && !$success) 
{
                        if( $connect = @ldap_connect($ldaphost) )
                        {
                                if( $bind =
@ldap_bind($connect,$ldapbinddn,$lda
pbindpasswd) )
                                {
                                        $filter =
"($ldapuserattr=$username)";
                                        $search = @ldap_search($connect
, $ldapbasedn, $filter, array('cn'));
                                        $info =
@ldap_get_entries($connect, $sea
rch);
                                        if($info[0]['dn'])
                                        {
                                                if(ldap_bind($connect,
$info[0][
'dn'], $password) )
                                                {
                                                        $success = 1;
                                                } else {

                                                        $fail = 1;
                                                }
                                        } else {

                                                $fail = 1;
                                        }
                                }
                        }

                        ldap_unbind($connect);
                }
        }


Expected result:
----------------
ldap_search() to return an ldap search resource to pass on to
ldap_get_entries

Actual result:
--------------
ldap_search(): Search: Operations error

-- 
Edit bug report at http://bugs.php.net/?id=25921&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25921&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25921&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25921&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25921&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25921&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25921&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25921&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25921&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25921&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25921&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25921&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25921&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25921&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25921&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25921&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25921&r=float

Reply via email to