summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-30 17:03:24 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-30 17:03:24 -0400
commit8331cdefa16c98e178aefc38cca254a72627aeab (patch)
tree0e36875d51a1ec708b56bff5861ba91db5336e45 /src
parent91a5c2e9ef1e66d7c846a2f944b889f23ec92f11 (diff)
- merge the backend-specific headers
- start switching to using the shared implementations in back-nis
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am4
-rw-r--r--src/back-nis.c573
-rw-r--r--src/back-nis.h8
-rw-r--r--src/back-sch.c2
-rw-r--r--src/format.c2
-rw-r--r--src/map.c2
6 files changed, 9 insertions, 582 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 442f3b8..809fe04 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,7 +9,7 @@ dist_noinst_SCRIPTS = ypmaplist.py
plugin_LTLIBRARIES = nisserver-plugin.la schemacompat-plugin.la
nisserver_plugin_la_SOURCES = \
back-nis.c \
- back-nis.h \
+ backend.h \
back-shr.c \
back-shr.h \
defs-nis.c \
@@ -32,7 +32,7 @@ nisserver_plugin_la_LIBADD = $(RUNTIME_LIBS) $(LIBWRAP) -lnsl $(LIBPTHREAD)
schemacompat_plugin_la_SOURCES = \
back-sch.c \
- back-sch.h \
+ backend.h \
back-shr.c \
back-shr.h \
format.c \
diff --git a/src/back-nis.c b/src/back-nis.c
index a91c4f3..00b824e 100644
--- a/src/back-nis.c
+++ b/src/back-nis.c
@@ -44,7 +44,7 @@
#endif
#include "backend.h"
-#include "back-nis.h"
+#include "back-shr.h"
#include "defs-nis.h"
#include "disp-nis.h"
#include "format.h"
@@ -1221,8 +1221,8 @@ backend_entry_matches_map(struct backend_map_data *map_data,
}
/* Given an entry, return true if it describes a NIS map. */
-static bool_t
-backend_entry_is_a_map(struct plugin_state *state,
+bool_t
+backend_entry_is_a_set(struct plugin_state *state,
Slapi_PBlock *pb, Slapi_Entry *e)
{
Slapi_DN *entry_sdn, *plugin_sdn;
@@ -1279,574 +1279,9 @@ backend_entry_is_a_map(struct plugin_state *state,
return ret;
}
-/* Update any entries to which the passed-in entry in the passed-in map refers
- * to, if the referred-to entry is in this map. Everybody got that? */
-struct backend_update_references_cbdata {
- Slapi_PBlock *pb;
- Slapi_Entry *e;
-};
-
-static bool_t
-backend_update_references_cb(const char *domain, const char *map, bool_t secure,
- void *backend_data, void *cbdata_ptr)
-{
- struct plugin_state *state;
- struct backend_map_data *map_data;
- struct backend_update_references_cbdata *cbdata;
- Slapi_DN *referred_to_sdn;
- Slapi_ValueSet *values;
- Slapi_Value *value;
- char **ref_attrs, *actual_attr, *filter, *tndn;
- struct format_inref_attr **inref_attrs;
- const char *ndn, *dn;
- int i, j, disposition, buffer_flags, filter_size, n_ref_attrs;
-
- map_data = backend_data;
- cbdata = cbdata_ptr;
- state = map_data->state;
-
- /* For every entry in this map which refers to this entry using
- * a DN stored in an attribute, update that entry. */
-
- /* Build a filter with all of these attributes and this entry's DN. */
- ref_attrs = map_data->ref_attrs;
- for (i = 0; (ref_attrs != NULL) && (ref_attrs[i] != NULL); i++) {
- continue;
- }
- n_ref_attrs = i;
- if (n_ref_attrs > 0) {
- filter_size = strlen("(&(|))") +
- strlen(map_data->entry_filter) +
- 1;
- ndn = slapi_entry_get_ndn(cbdata->e);
- tndn = format_escape_for_filter(ndn);
- if (tndn == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "error building filter for "
- "updating entries\n");
- return TRUE;
- }
- for (i = 0;
- (ref_attrs != NULL) && (ref_attrs[i] != NULL);
- i++) {
- filter_size += (strlen("(=)") +
- strlen(ref_attrs[i]) +
- strlen(ndn));
- }
- filter = malloc(filter_size);
- if (filter == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "error building filter for "
- "updating entries\n");
- free(tndn);
- return TRUE;
- }
- sprintf(filter, "(&%s(|", map_data->entry_filter);
- for (i = 0;
- (ref_attrs != NULL) && (ref_attrs[i] != NULL);
- i++) {
- sprintf(filter + strlen(filter),
- "(%s=%s)", ref_attrs[i], tndn);
- }
- strcat(filter, "))");
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "searching for referrers using filter \"%s\"\n",
- filter);
- free(tndn);
- /* Update any matching entry. */
- for (i = 0;
- (map_data->bases != NULL) && (map_data->bases[i] != NULL);
- i++) {
- slapi_search_internal_set_pb(cbdata->pb,
- map_data->bases[i],
- LDAP_SCOPE_SUB,
- filter,
- NULL, FALSE,
- NULL,
- NULL,
- state->plugin_identity,
- 0);
- slapi_search_internal_callback_pb(cbdata->pb, map_data,
- NULL,
- backend_map_config_entry_set_one_cb,
- NULL);
- }
- free(filter);
- }
-
- /* Allocate the DN we'll use to hold values for comparison. */
- referred_to_sdn = slapi_sdn_new();
- if (referred_to_sdn == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "error updating entries referred to by %s\n",
- slapi_entry_get_ndn(cbdata->e));
- return TRUE;
- }
-
- /* For every directory entry to which this directory entry refers and
- * which also has a corresponding entry in this map, update it. */
- inref_attrs = map_data->inref_attrs;
- for (i = 0; (inref_attrs != NULL) && (inref_attrs[i] != NULL); i++) {
- /* We're only processing inref attributes for this map. */
- if ((strcmp(inref_attrs[i]->domain, domain) != 0) ||
- (strcmp(inref_attrs[i]->map, map) != 0)) {
- continue;
- }
- /* Extract the named attribute from the entry. */
- values = NULL;
- if (slapi_vattr_values_get(cbdata->e,
- inref_attrs[i]->attribute,
- &values, &disposition, &actual_attr,
- 0, &buffer_flags) != 0) {
- continue;
- }
- /* For each value of this attributes.. */
- for (j = slapi_valueset_first_value(values, &value);
- j != -1;
- j = slapi_valueset_next_value(values, j, &value)) {
- /* Pull out the value, which is a referred-to entry's
- * DN. */
- dn = slapi_value_get_string(value);
- if (dn == NULL) {
- continue;
- }
- /* Normalize the DN. */
- slapi_sdn_set_dn_byref(referred_to_sdn, dn);
- ndn = slapi_sdn_get_ndn(referred_to_sdn);
- /* If the named entry corresponds to an entry that's
- * already in this map. */
- if (map_data_check_entry(state, domain, map, ndn)) {
- /* ...update it. */
- backend_map_config_entry_set_one_dn(state, ndn,
- map_data);
- }
- }
- slapi_vattr_values_free(&values, &actual_attr,
- buffer_flags);
- }
- slapi_sdn_free(&referred_to_sdn);
- return TRUE;
-}
-
-static void
-backend_update_references(struct plugin_state *state, Slapi_Entry *e)
-{
- struct backend_update_references_cbdata cbdata;
- cbdata.e = e;
- cbdata.pb = slapi_pblock_new();
- if (!map_data_foreach_map(state, NULL,
- backend_update_references_cb, &cbdata)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- state->plugin_desc->spd_id,
- "error updating references for \"%s\"\n",
- slapi_entry_get_ndn(cbdata.e));
- }
- slapi_pblock_destroy(cbdata.pb);
-}
-
-/* Add any map entries which correspond to a directory server entry in this
- * map. */
-
-struct backend_add_entry_cbdata {
- struct plugin_state *state;
- Slapi_PBlock *pb;
- Slapi_Entry *e;
- char *ndn;
-};
-
-static bool_t
-backend_add_entry_cb(const char *domain, const char *map, bool_t secure,
- void *backend_data, void *cbdata_ptr)
-{
- struct backend_map_data *map_data;
- struct backend_add_entry_cbdata *cbdata;
-
- map_data = backend_data;
- cbdata = cbdata_ptr;
-
- /* If the entry doesn't match the map, skip it. */
- if (!backend_entry_matches_map(map_data, cbdata->pb, cbdata->e)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata->state->plugin_desc->spd_id,
- "entry \"%s\" does not belong in "
- "\"%s\"/\"%s\"\n",
- cbdata->ndn, domain, map);
- return TRUE;
- }
-
- /* Set the entry in the map which corresponds to this entry, or clear
- * any that might if this entry doesn't have a key and value. */
- backend_map_config_entry_set_one(cbdata->e, map_data);
-
- return TRUE;
-}
-
-static int
-backend_add_cb(Slapi_PBlock *pb)
-{
- struct backend_add_entry_cbdata cbdata;
-
- slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
- slapi_pblock_get(pb, SLAPI_ADD_TARGET, &cbdata.ndn);
- slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e);
- cbdata.pb = pb;
- slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id,
- "added \"%s\"\n", cbdata.ndn);
-
- /* Check for NULL entries, indicative of a failure elsewhere (?). */
- if (cbdata.e == NULL) {
- slapi_pblock_get(pb, SLAPI_ADD_EXISTING_DN_ENTRY, &cbdata.e);
- if (cbdata.e == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "added entry is NULL\n");
- return 0;
- }
- }
-
- /* Add map entries which corresponded to this directory server
- * entry. */
- map_wrlock();
- if (!map_data_foreach_map(cbdata.state, NULL,
- backend_add_entry_cb, &cbdata)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "error adding map entries corresponding to "
- "\"%s\"\n", cbdata.ndn);
- }
-
- /* If it's a map configuration entry, add and populate the maps it
- * describes. */
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "new entry \"%s\" is a map\n", cbdata.ndn);
- backend_map_config_entry_add_cb(cbdata.e, cbdata.state);
- }
-
- /* Update entries which need to be updated in case this new entry
- * refers to them. */
- backend_update_references(cbdata.state, cbdata.e);
-
- map_unlock();
- return 0;
-}
-
-struct backend_modify_entry_cbdata {
- struct plugin_state *state;
- Slapi_PBlock *pb;
- LDAPMod **mods;
- Slapi_Entry *e_pre, *e_post;
- char *ndn;
-};
-
-static bool_t
-backend_modify_entry_cb(const char *domain, const char *map, bool_t secure,
- void *backend_data, void *cbdata_ptr)
-{
- struct backend_map_data *map_data;
- struct backend_modify_entry_cbdata *cbdata;
-
- map_data = backend_data;
- cbdata = cbdata_ptr;
-
- /* If the entry used to match the map, remove it. */
- if (backend_entry_matches_map(map_data, cbdata->pb, cbdata->e_pre)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata->state->plugin_desc->spd_id,
- "clearing domain/map/id "
- "\"%s\"/\"%s\"/(\"%s\")\n",
- map_data->domain, map_data->map, cbdata->ndn);
- map_data_unset_entry_id(cbdata->state,
- map_data->domain, map_data->map,
- cbdata->ndn);
- }
- /* If the entry now matches the map, add it (or re-add it). */
- if (backend_entry_matches_map(map_data, cbdata->pb, cbdata->e_post)) {
- /* Set the entry in the map which corresponds to this entry, or
- * clear any that might if this entry doesn't have a key and
- * value. */
- backend_map_config_entry_set_one(cbdata->e_post, map_data);
- }
- return TRUE;
-}
-
-static int
-backend_modify_cb(Slapi_PBlock *pb)
-{
- Slapi_DN *sdn;
- struct backend_modify_entry_cbdata cbdata;
- slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
- slapi_pblock_get(pb, SLAPI_MODIFY_TARGET, &cbdata.ndn);
- slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &cbdata.mods);
- slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
- slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post);
- cbdata.pb = pb;
- slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id,
- "modified \"%s\"\n", cbdata.ndn);
- /* Check for NULL entries, indicative of a failure elsewhere (?). */
- if (cbdata.e_pre == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "pre-modify entry is NULL\n");
- return 0;
- }
- if (cbdata.e_post == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "post-modify entry is NULL\n");
- return 0;
- }
- /* Modify map entries which corresponded to this directory server
- * entry. */
- map_wrlock();
- if (!map_data_foreach_map(cbdata.state, NULL,
- backend_modify_entry_cb, &cbdata)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "error modifying map entries corresponding to "
- "\"%s\"\n", cbdata.ndn);
- }
- /* Update entries which need to be updated in case this entry
- * no longer refers to them. */
- backend_update_references(cbdata.state, cbdata.e_pre);
- /* Update entries which need to be updated in case this entry
- * now refers to them. */
- backend_update_references(cbdata.state, cbdata.e_post);
- /* If it's a map configuration entry, reconfigure, clear, and
- * repopulate the map. */
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e_pre)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "modified entry \"%s\" was a map\n",
- cbdata.ndn);
- backend_map_config_entry_delete_cb(cbdata.e_pre, cbdata.state);
- }
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e_post)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "modified entry \"%s\" is now a map\n",
- cbdata.ndn);
- backend_map_config_entry_add_cb(cbdata.e_post, cbdata.state);
- }
- /* Lastly, if the entry is our own entry, re-read parameters. */
- sdn = slapi_sdn_new_dn_byref(cbdata.state->plugin_base);
- if (sdn != NULL) {
- if ((strcmp(slapi_entry_get_ndn(cbdata.e_pre),
- slapi_sdn_get_ndn(sdn)) == 0) ||
- (strcmp(slapi_entry_get_ndn(cbdata.e_post),
- slapi_sdn_get_ndn(sdn)) == 0)) {
- backend_read_params(cbdata.state);
- }
- slapi_sdn_free(&sdn);
- }
- map_unlock();
- return 0;
-}
-
-struct backend_modrdn_entry_cbdata {
- struct plugin_state *state;
- Slapi_PBlock *pb;
- Slapi_Entry *e_pre, *e_post;
- char *ndn_pre, *ndn_post;
-};
-
-static bool_t
-backend_modrdn_entry_cb(const char *domain, const char *map, bool_t secure,
- void *backend_data, void *cbdata_ptr)
-{
- struct backend_map_data *map_data;
- struct backend_modrdn_entry_cbdata *cbdata;
- bool_t matched_pre, matched_post;
-
- map_data = backend_data;
- cbdata = cbdata_ptr;
-
- matched_pre = backend_entry_matches_map(map_data,
- cbdata->pb, cbdata->e_pre);
- matched_post = backend_entry_matches_map(map_data,
- cbdata->pb, cbdata->e_post);
-
- /* Now decide what to set, or unset, in this map. */
- if (matched_pre) {
- /* If it was a match for the map, clear the entry. */
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata->state->plugin_desc->spd_id,
- "clearing domain/map/id "
- "\"%s\"/\"%s\"/(\"%s\")\n",
- map_data->domain, map_data->map,
- cbdata->ndn_pre);
- map_data_unset_entry_id(cbdata->state,
- map_data->domain, map_data->map,
- cbdata->ndn_pre);
- }
- /* Set the entry in the map which corresponds to this entry, or clear
- * any that might if this entry doesn't have a key and value. */
- if (matched_post) {
- backend_map_config_entry_set_one(cbdata->e_post, map_data);
- }
- return TRUE;
-}
-
-static int
-backend_modrdn_cb(Slapi_PBlock *pb)
-{
- struct backend_modrdn_entry_cbdata cbdata;
- slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
- slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
- slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post);
- cbdata.ndn_pre = slapi_entry_get_ndn(cbdata.e_pre);
- cbdata.ndn_post = slapi_entry_get_ndn(cbdata.e_post);
- cbdata.pb = pb;
- slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id,
- "renamed \"%s\" to \"%s\"\n",
- cbdata.ndn_pre, cbdata.ndn_post);
- /* Check for NULL entries, indicative of a failure elsewhere (?). */
- if (cbdata.e_pre == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "pre-modrdn entry is NULL\n");
- return 0;
- }
- if (cbdata.e_post == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "post-modrdn entry is NULL\n");
- return 0;
- }
- /* Modify map entries which corresponded to this directory server
- * entry. */
- map_wrlock();
- if (!map_data_foreach_map(cbdata.state, NULL,
- backend_modrdn_entry_cb, &cbdata)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "error renaming map entries corresponding to "
- "\"%s\"\n", cbdata.ndn_post);
- }
- /* If it's a map configuration entry, reconfigure, clear, and
- * repopulate the map. */
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e_pre)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "renamed entry \"%s\" was a map\n",
- cbdata.e_pre);
- backend_map_config_entry_delete_cb(cbdata.e_pre, cbdata.state);
- }
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e_post)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "renamed entry \"%s\" is now a map\n",
- cbdata.e_post);
- backend_map_config_entry_add_cb(cbdata.e_post, cbdata.state);
- }
- map_unlock();
- return 0;
-}
-
-/* Delete any map entries which correspond to a directory server entry in this
- * map. */
-
-struct backend_delete_entry_cbdata {
- struct plugin_state *state;
- Slapi_PBlock *pb;
- Slapi_Entry *e;
- char *ndn;
-};
-
-static bool_t
-backend_delete_entry_cb(const char *domain, const char *map, bool_t secure,
- void *backend_data, void *cbdata_ptr)
-{
- struct backend_map_data *map_data;
- struct backend_delete_entry_cbdata *cbdata;
- map_data = backend_data;
- cbdata = cbdata_ptr;
- /* If it was in the map, remove it. */
- if (backend_entry_matches_map(map_data, cbdata->pb, cbdata->e)) {
- /* Remove this entry from the map. */
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata->state->plugin_desc->spd_id,
- "unsetting domain/map/id"
- "\"%s\"/\"%s\"=\"%s\"/\"%s\"/(\"%s\")\n",
- domain, map,
- map_data->domain, map_data->map,
- cbdata->ndn);
- map_data_unset_entry_id(cbdata->state, domain, map,
- cbdata->ndn);
- }
- return TRUE;
-}
-
-/* Called by the server when a directory server entry is deleted. */
-static int
-backend_delete_cb(Slapi_PBlock *pb)
-{
- struct backend_delete_entry_cbdata cbdata;
- slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
- slapi_pblock_get(pb, SLAPI_DELETE_TARGET, &cbdata.ndn);
- slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e);
- cbdata.pb = pb;
- slapi_log_error(SLAPI_LOG_PLUGIN, cbdata.state->plugin_desc->spd_id,
- "deleted \"%s\"\n", cbdata.ndn);
- /* Check for NULL entries, indicative of a failure elsewhere (?). */
- if (cbdata.e == NULL) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "deleted entry is NULL\n");
- return 0;
- }
- /* Remove map entries which corresponded to this directory server
- * entry. */
- map_wrlock();
- if (!map_data_foreach_map(cbdata.state, NULL,
- backend_delete_entry_cb, &cbdata)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "error removing map entries corresponding to "
- "\"%s\"\n", cbdata.ndn);
- }
- /* If it's a map configuration entry, remove the map. */
- if (backend_entry_is_a_map(cbdata.state, pb, cbdata.e)) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- cbdata.state->plugin_desc->spd_id,
- "deleted entry \"%s\" is a map\n", cbdata.ndn);
- backend_map_config_entry_delete_cb(cbdata.e, cbdata.state);
- }
- /* Update entries which need to be updated in case this entry no longer
- * refers to them. */
- backend_update_references(cbdata.state, cbdata.e);
- map_unlock();
- return 0;
-}
-
/* Set our post-op callbacks. */
void
backend_init(Slapi_PBlock *pb, struct plugin_state *state)
{
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "hooking up postoperation callbacks\n");
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_ADD_FN,
- backend_add_cb) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error hooking up add callback\n");
- }
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODIFY_FN,
- backend_modify_cb) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error hooking up modify callback\n");
- }
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_MODRDN_FN,
- backend_modrdn_cb) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error hooking up modrdn callback\n");
- }
- if (slapi_pblock_set(pb, SLAPI_PLUGIN_POST_DELETE_FN,
- backend_delete_cb) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error hooking up delete callback\n");
- }
+ backend_shr_postop_init(pb, state);
}
diff --git a/src/back-nis.h b/src/back-nis.h
index a97fc18..1f9aa9c 100644
--- a/src/back-nis.h
+++ b/src/back-nis.h
@@ -23,12 +23,4 @@
#define back_nis_h
struct plugin_state;
struct slapi_pblock;
-int backend_read_master_name(struct plugin_state *state, char **master);
-void backend_free_master_name(struct plugin_state *state, char *master);
-void backend_startup(struct plugin_state *state);
-void backend_init(struct slapi_pblock *pb, struct plugin_state *state);
-void backend_get_map_config(struct plugin_state *state,
- const char *domain, const char *map,
- char ***bases, char **entry_filter);
-void backend_free_map_config(char **bases, char *entry_filter);
#endif
diff --git a/src/back-sch.c b/src/back-sch.c
index 1e63c60..604d9ab 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -44,7 +44,7 @@
#endif
#include "backend.h"
-#include "back-sch.h"
+#include "backend.h"
#include "back-shr.h"
#include "format.h"
#include "plugin.h"
diff --git a/src/format.c b/src/format.c
index a17024d..c1482c6 100644
--- a/src/format.c
+++ b/src/format.c
@@ -41,7 +41,7 @@
#include <rpcsvc/yp.h>
-#include "back-nis.h"
+#include "backend.h"
#include "back-shr.h"
#include "format.h"
#include "plugin.h"
diff --git a/src/map.c b/src/map.c
index 385e590..5494886 100644
--- a/src/map.c
+++ b/src/map.c
@@ -40,7 +40,7 @@
#include <rpc/rpc.h>
-#include "back-nis.h"
+#include "backend.h"
#include "disp-nis.h"
#include "map.h"
#include "portmap.h"