2.6 Extending the Schema

The eDirectory schema can be extended through LDAP programmatically using LDAP functions or using an LDIF file with a utility such as the Novell Import Convert Export Utility and ldapmodify.

The following steps give a simple example how to programmatically extend the schema by creating an auxiliary class that uses existing attributes.

  1. Create a NULL-terminated string that defines the OID, the class name, description, super class, class type, must attributes, and may attributes. RFC 2252 defines the format of the string.

    It should look similar to the following definition for the TestAuxClass.

      char   *auxClassDefVals[] = { "( 1.1.1.1.1.1111 
         NAME ’TestAuxClass’ 
         DESC ’Useless ObjectClass for testing’ 
         SUP ’top’ 
         AUXILIARY 
         MUST ( operator $ server ) 
         MAY ( status ) )"
             , NULL };
      

    NOTE:You need to use a valid OID when extending the schema. To register and obtain a unique OID for your group of attribute and class extensions, see the Novell Developer Support Web site

  2. Create an LDAPMod structure for the class.

    • Set the mod_op to LDAP_MOD_ADD

    • Set the mod_type to "objectclasses"

    • Set the mod_values to the string (in the example above, to auxClassDefVals)

  3. Add each structure to a NULL-terminated array of LDAPMod structures.

  4. To add the class, call ldap_modify_ext_s with the parameters set to the following values:

    • dn to "cn=schema" (the name of the schema is obtained by reading the root DSE; see Section 2.2, Reading the Root DSE)

    • mods to the NULL-terminated array of LDAPMod structures you have created

    • serverctrls to NULL

    • clientctrls to NULL