Skip Navigation Links | |
Exit Print View | |
Oracle Directory Server Enterprise Edition Developer's Guide 11 g Release 1 (11.1.1.5.0) |
Part I Directory Server Plug-In API Guide
1. Before You Start Writing Plug-Ins
2. Changes to the Plug-In API Since Directory Server 5.2
3. Getting Started With Directory Server Plug-Ins
4. Working With Entries Using Plug-Ins
Converting To and From LDIF Representations
Converting an LDIF String to a Slapi_Entry Structure
Converting a Slapi_Entry Structure to an LDIF String
Getting Entry Attributes and Attribute Values
Adding and Removing Attribute Values
Handling Entry Distinguished Names
Getting the Parent and Suffix DNs
Determining Whether a Suffix Is Served Locally
Is the User the Directory Manager?
5. Extending Client Request Handling Using Plug-Ins
6. Handling Authentication Using Plug-Ins
7. Performing Internal Operations With Plug-Ins
8. Writing Entry Store and Entry Fetch Plug-Ins
9. Writing Extended Operation Plug-Ins
10. Writing Matching Rule Plug-Ins
11. Writing Password Storage Scheme Plug-Ins
12. Writing Password Quality Check Plug-Ins
13. Writing Computed Attribute Plug-Ins
Part II Directory Server Plug-In API Reference
14. Data Type and Structure Reference
15. Function Reference, Part I
16. Function Reference, Part II
This section demonstrates how to check that an entry is valid with respect to the directory schema known to Directory Server. Verify schema compliance for an entry with slapi_entry_check(). The two arguments of the function are a pointer to a parameter block and a pointer to the entry, as shown in the following example.
Example 4-7 Checking Schema Compliance (entries.c)
#include "slapi-plugin.h" int test_create_entry() { Slapi_Entry * entry = NULL; /* Original entry */ Slapi_Entry * ecopy = NULL; /* Copy entry */ entry = slapi_entry_alloc(); /* Add code to fill the entry, setting the DN and attributes. */ ecopy = slapi_entry_dup(entry); slapi_entry_set_dn(ecopy, slapi_ch_strdup("dc=example,dc=org")); slapi_entry_add_string(ecopy, "description", "A copy of the orig."); /* Does the resulting copy comply with the schema? */ if (slapi_entry_schema_check(NULL, ecopy) == 0) { /* Resulting entry does comply. */ ; } else { /* Resulting entry does not comply. */ ; } slapi_entry_free(entry); slapi_entry_free(ecopy); return (0); }
Notice that the parameter block pointer argument is NULL. Leave the parameter block pointer argument NULL in most cases. When the plug-in is used in a replicated environment, you can use the argument to prevent schema compliance verification for replicated operations.