| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- # BEGIN COPYRIGHT BLOCK
- # This Program is free software; you can redistribute it and/or modify it under
- # the terms of the GNU General Public License as published by the Free Software
- # Foundation; version 2 of the License.
- #
- # This Program is distributed in the hope that it will be useful, but WITHOUT
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License along with
- # this Program; if not, write to the Free Software Foundation, Inc., 59 Temple
- # Place, Suite 330, Boston, MA 02111-1307 USA.
- #
- # In addition, as a special exception, Red Hat, Inc. gives You the additional
- # right to link the code of this Program with code not covered under the GNU
- # General Public License ("Non-GPL Code") and to distribute linked combinations
- # including the two, subject to the limitations in this paragraph. Non-GPL Code
- # permitted under this exception must only link to the code of this Program
- # through those well defined interfaces identified in the file named EXCEPTION
- # found in the source code files (the "Approved Interfaces"). The files of
- # Non-GPL Code may instantiate templates or use macros or inline functions from
- # the Approved Interfaces without causing the resulting work to be covered by
- # the GNU General Public License. Only Red Hat, Inc. may make changes or
- # additions to the list of Approved Interfaces. You must obey the GNU General
- # Public License in all respects for all of the Program code and other code used
- # in conjunction with the Program except the Non-GPL Code covered by this
- # exception. If you modify this file, you may extend this exception to your
- # version of the file, but you are not obligated to do so. If you do not wish to
- # provide this exception without modification, you must delete this exception
- # statement from your version and license this file solely under the GPL without
- # exception.
- #
- #
- # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- # Copyright (C) 2005 Red Hat, Inc.
- # All rights reserved.
- # END COPYRIGHT BLOCK
- #
- ----------------------------
- Sample Server Plug-Ins
- for Directory Server 7
- ----------------------------
- This directory contains code for some sample server plug-ins intended for
- use with the Fedora Directory Server 7.
- NOTE: Before you compile and run these examples, make sure
- to change any server-specific data in the examples to
- values applicable to your Directory Server.
- testbind.c
- ----------
- This is an example of a pre-operation bind plug-in function that
- handles authentication. When processing an LDAP bind request, the
- server calls this plug-in function before calling the database bind
- function.
- testentry.c
- -----------
- This is an example of an entry store plug-in function and an entry fetch
- plug-in function. You must be using the default database (not your own
- back-end database) in order for these plug-in functions to work.
- testextendedop.c
- ----------------
- This is an example of an extended operation plug-in function that
- handles requests for the extended operation with the OID 1.2.3.4.
- The example should be used in conjunction with the reqextop.c and
- ReqExtOp.java clients (the source code for these clients is located
- in the clients subdirectory). These clients are capable of requesting
- the extended operation with the OID 1.2.3.4.
- testpostop.c
- ------------
- This contains examples of post-operation plug-in functions. These
- functions are called after the server processes LDAP operations.
- The functions log changes to the directory in a change log file.
- testpreop.c
- -----------
- This contains examples of pre-operation plug-in functions. These
- functions are called before the server processes LDAP operations.
- testsaslbind.c
- --------------
- This is an example of a pre-operation plug-in function that
- implements a SASL mechanism.
- clients
- -------
- This directory contains the C and Java source code for clients
- that you can use to test the server plug-ins. See the README
- file in that directory for details.
- ----------------------------
- How To Create
- A Server Plug-In
- ----------------------------
- Text between brackets ([]) should be replaced with values specific to
- your situation.
- Creating the Plug-In Library
- ----------------------------
- Server plug-ins are built as libraries available to the server.
- 1. Include the Plug-In API. For example:
- #include "[serverRoot]/plugins/slapd/slapi/include/slapi-plugin.h"
- 2. Write your plug-in, including a top level initialization function
- used by the server to start the plug-in. For example:
- /* Plug-in functions defined here */
- int my_plugin_init( Slapi_PBlock *pb ) /* initialize param. block */
- {
- /* Set or get the parameters in pb */
- slapi_pblock_set();
- slapi_pblock_get();
- /* Plug-in functions registered here */
- if (error)
- {
- slapi_log_error();
- return error_code;
- }
- else return 0;
- } /* my_plugin_init() */
- See the Parameter Block Reference in the Netscape Directory Server
- Plug-In Programmer's Guide for hints on plug-in types.
- 3. Build the plug-in as a library.
- We recommend you copy and adapt the Makefile in
- [serverRoot]/plugins/slapd/slapi/examples.
- Plugging the Library Into the Server
- ------------------------------------
- When started, the server loads plug-ins.
- 1. Stop the server.
- Console: Select the server; Object > Stop Server
- Command Line: cd [serverRoot]/slapd-[serverID] ; ./stop-slapd
- 2. Add the entry for the server plug-in to
- [serverRoot]/slapd-[serverID]/config/dse.ldif. For example:
- dn: cn=[My Server Plugin],cn=plugins,cn=config
- objectClass: top
- objectClass: nsSlapdPlugin
- objectClass: extensibleObject
- cn: [My Server Plugin]
- nsslapd-pluginPath: [[serverRoot]/myPlugins/myveryown-plugin.so]
- nsslapd-pluginInitfunc: [my_plugin_init]
- nsslapd-pluginType: [myPluginType]
- nsslapd-pluginEnabled: on
- nsslapd-pluginarg0: [uid]
- nsslapd-pluginarg1: [mail]
- nsslapd-pluginarg2: [...]
- nsslapd-plugin-depends-on-type: [anotherPluginType]
- nsslapd-pluginId: [MyFirstServerPlugin]
- nsslapd-pluginVersion: [0.1]
- nsslapd-pluginVendor: [Fictional Software Company Incorporated]
- nsslapd-pluginDescription: [Add lots of cool functionality]
- See the Parameter Block Reference in the Netscape Directory Server
- Plug-In Programmer's Guide for hints on plug-in types.
- 3. Restart the server.
- Console: Object > Start Server
- Command Line: cd [serverRoot]/slapd-[serverID] ; ./restart-slapd
|