ldap_search(): Partial search results returned: Sizelimit exceeded
| From: | Jay Blanchard | Date: | Tue, 17 Jul 2007 21:51:04 +0000 |
| Subject: | ldap_search(): Partial search results returned: Sizelimit exceeded | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-259041@lists.php.net to get a copy of this message | ||
Perhaps mistakenly for a project that I am trying to do I want to list
all users in the Active Directory. It works pretty well with one
exception, the error ldap_search(): Partial search results returned:
Sizelimit exceeded.
Now, I know that I can page through (I would have to figure out a clever
way to display to the user) these.
I have read some stuff that says the limit is hard coded in AD, so there
is no way around it. I just wanted to check with you folks to see if you
had any clever ideas on how to work around this.
TVMIA!
$username = $_SESSION['user'];
$password = $_SESSION['password'];
if(!$ds=ldap_connect("172.17.16.161")){
echo "did not connect...please contact system administrator or
go back to try again";
}
$un = "foobar\\".$username;
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_SIZELIMIT, 2000);
if(!$r=ldap_bind($ds, $un, $password)){
echo 'You are not authorized and or, your login information was
incorrect';
} else {
$sr=ldap_search($ds, "dc=domain, dc=local", "mailnickname=");
$info = ldap_get_entries($ds, $sr);
$sr= ldap_search($ds, "dc=domain, dc=local", "mailnickname=*");
$info = ldap_get_entries($ds, $sr);
echo count($info) . "<br />";
for ($i=0; $i<count($info); $i++) {
echo $info[$i]["mailnickname"][0] . "<br />";
}
}