Step 3: Inspecting directory objects

Applications inspect the contents of a directory object with several calls to ct_ds_objinfo. To an application, a directory object consists of the following visible pieces:

An object’s directory object class determines the object’s attributes and the expected syntax (that is, datatype) for each attributes’ values.

Although object attributes appear as a numbered set, an application should be coded to work independently of the order in which attributes are returned. A directory object class does not define an ordering of attributes, and most directory services do not guarantee that attributes will be ordered consistently for different directory objects in the same object class.

Most applications use a program structure similar to the one below to inspect a directory object:

 ct_ds_objinfo to get the directory object class (optional)
  ct_ds_objinfo to get the fully qualified name
 ... application code to process fully qualified name ...
 for each desired attribute type
   ct_ds_objinfo to get number of attributes
   i = 0
   while i is less than number of attributes
     i = i + 1
     ct_ds_objinfo to retrieve the metadata for attribute i
     compare returned attribute type to desired attribute type
     if attribute types match
        /* i is the number of the desired attribute */
        break while
     end if
   end while
   allocate sufficient space for attribute i’s values
   ct_ds_objinfo to retrieve attribute i’s values
   ... application code to process attribute values ...
 end for