开发者

JNDI Obtain the size of a LDAP search without retrieving all the data

I need to know how many users and groups are in my LDAP directory. The search looks fairly simple:

(| (objectClass=group)(objectClass=user))

The problem is that the API is very limited. I can only ge开发者_JS百科t a NamingEnumeration<SearchResult> and it doesn't have a count. I didn't find any functions we can use, like the count in SQL.

Is there any way I can get this count without having to retrieve the full query and count the results with a loop?


The only way I found to do this was to make a query for an empty attribute array, then loop and increment a counter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜