summaryrefslogtreecommitdiffstats
path: root/ldap/servers/plugins/retrocl/retrocl.c
diff options
context:
space:
mode:
authorRich Megginson <rmeggins@redhat.com>2009-08-25 13:20:47 -0600
committerRich Megginson <rmeggins@redhat.com>2009-08-25 13:24:29 -0600
commit30e3822919e20cb13dfc5dabc50e7c1fe5e21d40 (patch)
tree6677a7a1a062931b63b7b0a022959198b1cca6ca /ldap/servers/plugins/retrocl/retrocl.c
parent66aa2197b7de316f540fe924ea3435c9275a82d7 (diff)
downloadds-1.2.tar.gz
ds-1.2.tar.xz
ds-1.2.zip
Need to store additional attributes in Retro Changelog389-ds-base-1.2.21.2
https://bugzilla.redhat.com/show_bug.cgi?id=504651 Resolves: 504651 Bug Description: Need to store additional attributes in Retro Changelog Submitted by: Endi Sukma Dewata <edewata@redhat.com> Reviewed by: rmeggins (thanks!) Platforms tested: FC10 x86_64 Fix Description: The fix allows recording some user-defined attributes from the target entry of the operation (e.g. objectGUID) and built-in attributes generated by the plugin (e.g. isReplicated) into the change log entry. The attributes should be specified in the configuration entry: dn: cn=Retro Changelog Plugin,cn=plugins,cn=config ... nsslapd-attribute: objectGUID nsslapd-attribute: isReplicated The change log entry will contain the additional attributes: dn: changeNumber=...,cn=changelog ... objectGUID: ... isReplicated: ... ---
Diffstat (limited to 'ldap/servers/plugins/retrocl/retrocl.c')
-rw-r--r--ldap/servers/plugins/retrocl/retrocl.c40
1 files changed, 31 insertions, 9 deletions
diff --git a/ldap/servers/plugins/retrocl/retrocl.c b/ldap/servers/plugins/retrocl/retrocl.c
index dd900f2b..0fb15c2f 100644
--- a/ldap/servers/plugins/retrocl/retrocl.c
+++ b/ldap/servers/plugins/retrocl/retrocl.c
@@ -76,6 +76,8 @@ void plugin_init_debug_level(int *level_ptr)
void* g_plg_identity [PLUGIN_MAX];
Slapi_Backend *retrocl_be_changelog = NULL;
+int retrocl_nattributes = 0;
+char **retrocl_attributes = NULL;
/* ----------------------------- Retrocl Plugin */
@@ -298,21 +300,39 @@ static int retrocl_start (Slapi_PBlock *pb)
{
static int retrocl_started = 0;
int rc = 0;
+ Slapi_Entry *e = NULL;
- if (!retrocl_started) {
- retrocl_rootdse_init();
+ if (retrocl_started) {
+ return rc;
+ }
+
+ retrocl_rootdse_init();
- rc = retrocl_select_backend();
+ rc = retrocl_select_backend();
- if (rc == 0) {
- retrocl_init_trimming();
- } else {
- LDAPDebug1Arg(LDAP_DEBUG_TRACE,"Couldnt find backend, not trimming retro changelog (%d).\n",rc);
- }
+ if (rc != 0) {
+ LDAPDebug1Arg(LDAP_DEBUG_TRACE,"Couldnt find backend, not trimming retro changelog (%d).\n",rc);
+ return rc;
}
+ retrocl_init_trimming();
+
+ if (slapi_pblock_get(pb, SLAPI_ADD_ENTRY, &e) != 0) {
+ slapi_log_error(SLAPI_LOG_FATAL, RETROCL_PLUGIN_NAME, "Missing config entry.\n");
+ return -1;
+ }
+
+ retrocl_attributes = slapi_entry_attr_get_charray(e, "nsslapd-attribute");
+ if (retrocl_attributes != NULL) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, "Attributes:\n");
+ for (retrocl_nattributes=0; retrocl_attributes && retrocl_attributes[retrocl_nattributes]; retrocl_nattributes++) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, RETROCL_PLUGIN_NAME, " - %s\n", retrocl_attributes[retrocl_nattributes]);
+ }
+ }
+
retrocl_started = 1;
- return rc;
+
+ return 0;
}
/*
@@ -330,6 +350,8 @@ static int retrocl_stop (Slapi_PBlock *pb)
{
int rc = 0;
+ slapi_ch_array_free(retrocl_attributes);
+
retrocl_stop_trimming();
retrocl_be_changelog = NULL;
retrocl_forget_changenumbers();