Searching and Comparing
The LDAP SDK allows you to compare a value in memory to the value of an attribute of an entry without actually retrieving the entry. This is called a compare operation. In many ways a compare can be simulated using a search by setting the scope of the search to SCOPE_BASE and providing a search filter with which the value can be compared; if an entry is returned, the compare operation was successful. A compare, however, may improve performance because the return data from the LDAP server is a small packet that says either that the value is the same or that it is different.
Let's examine a small piece of code to compare a specific record and see if the l attribute (the LDAP attribute for location) has the value Santa Clara ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access