It seems like the OpenLDAP libs is forcing a load of
the ldap.conf file... In that there's the BASE option
(which tells the clients where/what the base is).

In my development systems, I use LDAP as database for
users etc (together with Kerberos).

The problem is that I also run development database(s) on
localhost, with different base(s), sometimes different
ports etc. When (trying) to get the namingContexts from
the database, I can't retreive them if BASE is set...

Is there a way to get ldap_read() to NOT use this value,
OR is my string wrong ($attrib here is 'namingcontexts')?

----- s n i p -----
        $sr = @ldap_read($this->ldap_linkid, NULL, '(objectClass=*)', array($attrib));
        if(! $sr) die("Can't find base dn - ".ldap_error($this->ldap_linkid));
        $entry = ldap_get_entries($this->ldap_linkid, $sr);
print_r($entry); die();
----- s n i p -----

By having 'BASE dc=com' in ldap.conf (which is the only
base I have in my non-development system), I will get
this:

----- s n i p -----
   Array ( [count] => 1 [0] => Array ( [count] => 0 [dn] => dc=com ) )
----- s n i p -----

Uncommenting the BASE value from ldap.conf and restart
apache, I get the intended values:

----- s n i p -----
   Array ( [count] => 1 [0] => Array ( [namingcontexts] => Array ( [count] => 2 [0] => 
c=SE [1] => dc=com ) [0] =>
   namingcontexts [count] => 1 [dn] => ) )
----- s n i p -----

The intention is to copy the behaviour of the following
shell command:

ldapsearch -x -LLL -h localhost -s base -b '' objectclass=* namingContexts

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to