Previous Next

Step 5: Perform the Operations

The following code fragments show the ds_add_entry( ), ds_list( ), and the ds_remove_entry( ) calls.

First, the two ds_add_entry( ) function calls add the attribute lists contained in attr_list1 and attr_list2 to the distinguished names represented by dn_brendan and dn_sinead, respectively:

/* Add two entries to the GDS server. */

if (ds_add_entry(bound_session, DS_DEFAULT_CONTEXT,

dn_brendan, attr_list1,

&invoke_id) != DS_SUCCESS)

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

if (ds_add_entry(bound_session, DS_DEFAULT_CONTEXT,

dn_sinead, attr_list2,

&invoke_id) != DS_SUCCESS)

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

Next, list all the subordinates of the object referenced by the distinguished name /C=ie/O=sni/OU=ap:

if (ds_list(bound_session, DS_DEFAULT_CONTEXT, dn_ap,

&result, &invoke_id)

!= DS_SUCCESS)

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

The ds_list( ) call returns the result in the private object result to the workspace. The components of result are represented by OM attributes in the OM class DS_C_LIST_RESULT (as shown in the following figure) and can only be read by a series of om_get( ) calls.


OM Class DS_C_LIST_RESULT

Finally, remove the two entries from the directory:

if (ds_remove_entry(bound_session, DS_DEFAULT_CONTEXT,

dn_brendan, &invoke_id)

!= DS_SUCCESS)

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

if (ds_remove_entry(bound_session, DS_DEFAULT_CONTEXT,

dn_sinead, &invoke_id)

!= DS_SUCCESS)

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