|
||
|
|
Chapter 13 Using Data Interoperability Plug-Ins
This chapter explains how to use the Data Interoperability (DIOP) feature of Netscape Directory Server (Directory Server). The DIOP feature refers to Directory Server's ability to work with a proprietary database, instead of its default database that gets created during installation.
You can now use the enhanced pre-operation interfaces (instead of the database backend plug-in interface, support for which was dropped in 5.x and 6.x releases) to implement plug-ins that are designed to provide access to alternative directory data stores. You do this by developing a custom pre-operation plug-in to provide an alternate functionality for the LDAP operations, such as search, modify, add, and so on. These operations are generally targeted at the root suffix or the null DN (meaning
dn:), and your plug-in will have to be designed to intercept these operations and divert them to be serviced by an alternate data source or alternate access methods.This chapter covers deployment considerations, configuration changes required to use the DIOP feature, a list of supported and unsupported features, and other useful information.
This chapter contains the following sections:
- Installing Directory Server
![]()
- Enabling the DIOP Feature in Directory Server
![]()
- Using the DIOP Feature
![]()
- Sample DIOP Plug-In
![]()
- Plug-In API Reference
![]()
This section explains how to install Directory Server in order to test and use the DIOP feature.
Understanding Deployment Configuration
To verify whether the DIOP feature works in Directory Server, your deployment must comprise two instances of Directory Server:
- An instance of Directory Server that will be used for storing configuration data. This instance is identified as the configuration Directory Server.
![]()
- An instance of Directory Server that will be used for enabling the DIOP plug-in. This instance is identified as the DIOP-enabled Directory Server.
![]()
For detailed information on directory deployments, check the Netscape Directory Server Deployment Guide. To understand the role of a configuration Directory Server in a directory deployment, check Managing Servers with Netscape Console.
Note that because the DIOP plug-in is a pre-operation plug-in, enabling the plug-in will impose certain limitations on the default behavior of Directory Server.
- The Directory Server Console will not be fully functional in the DIOP-enabled Directory Server, and you will not be able to administer the server via the console. However, you will be able to use the configuration Directory Server's console to manage the DIOP-enabled Directory Server.
![]()
- Some of the default plug-ins that are provided with the server will not work in the DIOP-enabled Directory Server. The reason for this is that the DIOP plug-in is a pre-operation plug-in and intercepting all LDAP operations will result is the other plug-ins being unusable. Table 13-1 identifies plug-ins that are unsupported in the DIOP-enabled Directory Server. All unsupported plug-ins must be disabled before using the DIOP plug-in.
![]()
Table 13-1 Plug-In Status in DIOP-Enabled Directory Server
Figure 13-1 illustrates Directory Server deployment required for testing the DIOP feature.
Figure 13-1 A Typical Directory Server Deployment
![]()
In the above figure,
slapd-<configInstance>is the configuration Directory Server andslapd-<diopInstance>is the Directory Server instance with the DIOP plug-in turned on.
- The management and administration of
slapd-<configInstance>is done via the corresponding Directory Server Console, accessible from within Netscape Console.![]()
- The management and administration of
slapd-<diopInstance>is done via the Directory Server Console of theslapd-<configInstance>instance. This is because theslapd-<diopInstance>instance does not support the full functionality of Netscape Console.![]()
To summarize the installation requirements for testing the DIOP feature:
- You install two instances of Directory Server under the same server root (by specifying the same installation directory). For example, you can install two Directory Server instances
![]()
/usr/netscape/servers/slapd-<configInstance>
/usr/netscape/servers/slapd-<diopInstance>
- where
/usr/netscape/serversis the default installation directory. In the sections that follow, the installation directory is identified as<server_root>.
- After you install the two instances, you designate the second Directory Server instance (
slapd-<diopInstance>) for testing the DIOP feature.![]()
- You manage the first Directory Server instance (
slapd-<configInstance>) using Netscape Console and the corresponding Administration Server, which is running under the same server root.![]()
- You can indirectly manage the second Directory Server instance (
slapd-<diopInstance>) through the first Directory Server instance (slapd-<configInstance>).![]()
- You disable the unsupported plug-ins in the second Directory Server instance (
slapd-<diopInstance>).![]()
For general information about installing Directory Server, refer to the accompanying Netscape Directory Server Installation Guide. You can also find the documentation for Directory Server at:
http://enterprise.netscape.com/docs/directory/index.htmlInstalling Two Instances of Directory Server
Follow these instructions to create two instances of Directory Server:
- Read the installation-specific documents (Netscape Directory Server Installation Guide and Release Notes) and verify that your system meets the requirements specified in the documentation. Ensure that all patches are installed.
![]()
- Unset the environment variable:
unsetenv LD_LIBRARY_PATH![]()
- Unpack the binaries.
![]()
- Run the
setupprogram and install an instance of Directory Server (slapd-<configInstance>in Figure 13-1).![]()
- Start Administration Server.
![]()
<server_root>/start-admin
- Start Netscape Console.
![]()
<server_root>/startconsole
- Use Netscape Console to create a new/second instance of Directory Server (
slapd-<diopInstance>in Figure 13-1).![]()
- In the navigation pane, select the Server Group, right click, and select "Create Instance of Netscape Directory Server," and follow the prompts.
- Disable the unsupported plug-ins in the second instance (
slapd-<diopInstance>), which you will use for enabling the DIOP plug-in.![]()
- In Netscape Console, locate and double-click the entry for the second instance of Directory Server.
![]()
- This opens the Directory Server Console for the second instance.
- Select the Configuration tab, and expand Plugins.
![]()
- Disable each of these plug-ins listed in Table 13-1.
![]()
- To disable a plug-in, select the plug-in and then on the right panel, uncheck the "Enable the Plugin" option. Note that some plug-ins may depend on other plug-ins, and you may see messages that reflect such a dependency.
- Use the second instance to enable the DIOP feature, which is explained in the next section.
![]()
Enabling the DIOP Feature in Directory Server
For a Directory Server instance to support the DIOP feature, its default configuration needs to be modifiedthe server needs to be configured to use the null DN or the root suffix in the server. This can be done by adding the following entry to the
dse.ldiffile of the server instance in which you want to enable the DIOP feature:dn: cn="",cn=mapping tree,cn=config
objectClass: top
objectClass: extensibleObject
objectClass: nsMappingTree
cn: ""
nsslapd-state: containerYou can modify the
dse.ldifin either of the following ways:
- By editing the
dse.ldiffile directly:![]()
- Shut down your Directory Server.
![]()
<server_root>/slapd-<diopInstance>/stop-server
- In the text editor, open the
dse.ldiffile.![]()
- The file is located in the
<server_root>/slapd-<diopInstance>/config/dse.ldifdirectory.
- Add the above mentioned entry, and save your changes, and close the file.
![]()
- Restart the server.
![]()
<server_root>/slapd-<diopInstance>/start-server
- By using the
ldapmmodifycommand.![]()
- You can also add the above entry by running the
ldapmodifycommand on theslapd-<diopInstance>server with the an LDIF input file containing the above entry. For example, your command might look like this:
./ldapmodify -hhost-pport-wpassword-D "cn=directory manager" -vcafldif_file_containing_the_entry
Once you add the above entry to the server configuration, the DIOP functionality is enabled in the server.
An example plug-in is shipped with the server to show how a DIOP pre-operation plug-in can be used to work with the DIOP-enabled server. For details about the sample plug-in, see "Sample DIOP Plug-In".
To use the sample plug-in or your own custom plug-in in the server, see "Using the DIOP Feature".
This section explains how you can verify whether the DIOP feature works in Directory Server. After you have successfully installed and configured two instances of Directory Servers (as explained in the preceding sections), follow the instructions in this section.
Note that to help you understand the DIOP feature, a sample plug-in in provided. Details of this plug-in is covered in "Sample DIOP Plug-In". It is recommended that you review the sample plug-in first and use that as an example to develop your own plug-in.
To verify the DIOP feature, you may use the sample plug-in or reconfigure Directory Server to use your own plug-in. You can also remove the plug-in altogether from the server.
- If you want to use the sample plug-in, first build the plug-in and then load it into the server:
![]()
- Shut down your DIOP-enabled Directory Server.
![]()
- Go to the directory in which the sample plug-in is located.
![]()
cd <server_root>/plugins/slapd/slapi/examples
- Build the plug-in.
![]()
gmake
- Modify the
<server_root>/slapd-<diopInstance>/config/dse.ldiffile to include an entry for the plug-in. For instructions to modify thedse.ldiffile, see "Enabling the DIOP Feature in Directory Server". The entry shown below is for the sample plug-in.![]()
dn: cn=datainterop,cn=plugins,cn=config
objectClass: top
objectClass: nsSlapdPlugin
cn: datainterop
nsslapd-pluginPath: <server_root>/plugins/slapd/slapi/examples/libtest-plugin.so
nsslapd-pluginInitfunc: nullsuffix_init
nsslapd-pluginType: preoperation
nsslapd-pluginEnabled: on
nsslapd-pluginId: nullsuffix-preop
nsslapd-pluginVersion: 6.1
nsslapd-pluginVendor: Netscape
nsslapd-pluginDescription: sample pre-operation null suffix plugin
- Restart the server to load the modified configuration.
![]()
- If you want to reconfigure the server to use your own plug-in:
![]()
- Shut down your DIOP-enabled Directory Server.
![]()
- Open the
<server_root>/slapd-<diopInstance>/config/dse.ldiffile in a text editor.![]()
- Modify the
cn=datainterop,cn=plugins,cn=configentry, which holds the plug-in information, with data from your proprietary database plug-in.![]()
- After you have done the required changes, restart the server to load the modified configuration.
![]()
- If you want to delete the sample plug-in from the server:
![]()
You can also use the
ldapmodifycommand to make these changes.
To help you understand the DIOP feature, a sample DIOP plug-in is included with Directory Server. This section provides an overview of the sample plug-in and explains how you can use the plug-in to verify whether the DIOP feature works in Directory Server. The preceding section, "Using the DIOP Feature" explains how you can use the sample plug-in. The next section, "Debugging the Plug-In" explains how you can trobleshoot the plug-in.
The sample plug-in is located in the
<server_root>/plugins/slapd/slapi/examplesdirectory. The shared library for the plug-in is namedlibtest-plugin.soand is implemented by
testdatainterop.c[.h]
testdbinterop.c
db.hlocated in the same directory.
- The main goal of the sample plug-in is to show how to create a simple plug-in that supports data interoperability.
![]()
- The plug-in does not attempt to create any usable functionality to access backends (database or files), but returns observable output uniformly to verify that the functions in the pre-operation plug-in have been accessed and executed for different LDAP operations.
![]()
- The plug-in demonstrates the use of APIs, which meet the requirements of the DIOP feature.
![]()
In the following table, the various required elements of the pre-operation plug-in are identified by the function calls used in the
testdatainterop.c(to illustrate the use and simplify understanding).
Table 13-2 Elements of Pre-Operation Plug-In
#define PLUGIN_NAME "nullsuffix-preop"
static Slapi_PluginDesc plugindesc = { PLUGIN_NAME, "Netscape", "6.1", "sample pre-operation null suffix plugin"
}
nullsuffix_init( Slapi_PBlock *pb )In this function, all the callbacks are set up and will be called by the server for each LDAP operation.
Flag used for LDAP operation Callback
SLAPI_PLUGIN_PRE_SEARCH_FNnullsuffix_search
SLAPI_PLUGIN_PRE_ADD_FNnullsuffix_add
SLAPI_PLUGIN_PRE_MODIFY_FNnullsuffix_modify
SLAPI_PLUGIN_PRE_DELETE_FNnullsuffix_delete
slapi_op_reserved(pb)is called to determine whether the operation should be handled internally by Directory Server (for example, whether the base on which the operation is applied is a reserved naming context). Ifslapi_op_reserved()returns a non-zero value, the plug-in does not attempt to handle that operation. It is done by the following code snippet:
return PLUGIN_OPERATION_IGNORED;See
testdatainterop.cfor details.The
slapi_op_reserved()function, which can be used for reserving some of the naming contexts in the Directory Server (cn=schema,cn=config,cn=monitor), is called first in the database plug-in and then the call for turning off access control.Any mods done to the server on the null suffix are processed by the plug-in. The plug-in writes the DN of all mods received to a standalone Berkley db, and trying a simple test using LDIF entries without the required object classes or parent entries will still get processed by the server, populating the db created by the plug-in.
See
nullsuffix_modifyandtestdbinterop.cfor details.The plug-in has not been coded for the retrieval of those entries, but has been coded to demonstrate sparse tree support only.
Switching off access control for the operation is done by:
slapi_operation_set_flag(op, SLAPI_OP_FLAG_NO_ACCESS_CHECK );The plug-in cannot control the support for null-suffix in the server. The support for null-suffix is done through configuration modification of the server as shown in "Installing Directory Server".
The compiler used on Solaris 8 is Forte 6.2. For example:
cd <server_root>/plugins/slapd/slapi/examples
gmake
<libtest-plugin.so is generated>
If you need to debug the plug-in installed on a Solaris machine, you can use dbx:
cd <server_root>/bin/slapd/server![]()
setenv NETSITE_ROOT <server_root>![]()
dbx ns-slapd![]()
run -d 65536 -D <server_root>/slapd-<diopInstance>![]()
- Once the server starts up and error logs show that the server has started, press
Control C.![]()
stop in <user-defined-function-in-the-plugin>![]()
Similar steps can be done on other platforms, using the platform-specific debuggers and commands.
This section contains reference information on APIs that enable the following:
Preserving the Default Behavior of the Server
Directory Server implements internal backends for supporting subtrees
cn=config,cn=schema, andcn=monitor, which are the reserved naming contexts for the server. For more information about these, check the Netscape Directory Server Configuration, Command, and File Reference.It may be required in some cases to let the default behavior of the server be preserved and not be intercepted by the custom pre-operation plug-ins. To implement a custom DIOP plug-in without affecting the default behavior of the Directory Server, a new function named
slapi_op_reserved()is being made available. For details about this function, see "Functions Related to Data Interoperability".Bypassing Access Control Checks
It may be desirable to disable access control checking for operations that are handled by the custom DIOP plug-in. To enable the plug-ins to bypass access control, a new flag,
SLAPI_OP_FLAG_NO_ACCESS_CHECK, has been defined. You allow a custom plug-in to bypass access control by setting the flag on the operation-data structure, which is available to the plug-in through the parameter (pblock) setting; see Chapter 16 "Parameter Block Reference."The following functions have been defined for this purpose:
For details about these functions, see "Functions Related to Data Interoperability".
© 2001 Sun Microsystems, Inc. Portions copyright 1999, 2002 Netscape Communications Corporation. All rights reserved.
Last Updated August 23, 2002