PreviousNext

Step 7: Perform the Search Operation

The following code fragment from acl.c shows the ds_search( ) function call:

/* Search the whole subtree below root.

* The filter selects entries with an object-class attribute.

* The selection extracts the ACL attribute from each

* selected entry.

* The results are returned in the private object "result".

*

* NOTE: Since every entry contains an object-class attribute the

* filter performs no function other than to demonstrate how

* filters may be used.

*

*/

if(ds_search(bound_session, context, dn_root, DS_WHOLE_SUBTREE,

filter, OM_FALSE, selection_acl, &result, &invoke_id) != DS_SUCCESS)

printf("ds_search() error\n");

The ds_search( ) call returns the value DS_SUCCESS if the call successfully completes. Otherwise, it returns an error code. (Refer to XDS Class Definitions for a comprehensive list of error codes.)

The result of the search operation is returned to the workspace in a private object result. This result is returned as a single OM object. The components of the result are represented by OM attributes in the operation's result object.

The OM class returned by ds_search( ) is DS_C_SEARCH_RESULT. The superclasses, subclasses, and attributes for DS_C_SEARCH_RESULT are shown in the following figure.


OM Class DS_C_SEARCH_RESULT

The result object is returned to the workspace in a private implementation-specific format. As such, it cannot be read directly by an application program, but requires a series of om_get( ) function calls to extract the requested information.