From 27e14536df38eda34d6ea614cb988d51ff17b475 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Tue, 29 Aug 2017 10:00:17 -0400 Subject: [PATCH] Ticket 49038 - Revise creation of cn=replication,cn=config Description: Instead of adding the entry at every startup(and giving error 68), just include it by default in dse.ldif https://pagure.io/389-ds-base/issue/49038 Reviewed by: ? --- ldap/ldif/template-dse.ldif.in | 5 ++++ .../plugins/replication/repl5_replica_config.c | 29 ---------------------- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/ldap/ldif/template-dse.ldif.in b/ldap/ldif/template-dse.ldif.in index a3b850e..b6e09a6 100644 --- a/ldap/ldif/template-dse.ldif.in +++ b/ldap/ldif/template-dse.ldif.in @@ -40,6 +40,11 @@ cn: Sync Request Control aci: (targetattr != "aci")(version 3.0; acl "Sync Request Control"; allow( read , search ) userdn = "ldap:///all";) +dn: cn=replication,cn=config +objectclass: top +objectclass: nsContainer +cn: replication + dn: cn=plugins,cn=config objectclass: top objectclass: nsContainer diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c index 67a7e33..f28044c 100644 --- a/ldap/servers/plugins/replication/repl5_replica_config.c +++ b/ldap/servers/plugins/replication/repl5_replica_config.c @@ -103,33 +103,10 @@ dont_allow_that(Slapi_PBlock *pb __attribute__((unused)), return SLAPI_DSE_CALLBACK_ERROR; } -/* - * Create the entry at the top of the replication configuration subtree. - */ -static int -create_config_top(void) -{ - /* DN part of this entry_string: no need to be optimized. */ - char *entry_string = slapi_ch_strdup("dn: cn=replication,cn=config\nobjectclass: top\nobjectclass: extensibleobject\ncn: replication\n"); - Slapi_PBlock *pb = slapi_pblock_new(); - Slapi_Entry *e = slapi_str2entry(entry_string, 0); - int return_value; - - slapi_add_entry_internal_set_pb(pb, e, NULL, /* controls */ - repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0 /* flags */); - slapi_add_internal_pb(pb); - slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value); - slapi_pblock_destroy(pb); - slapi_ch_free((void **)&entry_string); - return return_value; -} - - int replica_config_init() { s_configLock = PR_NewLock(); - int rc = 0; if (s_configLock == NULL) { slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "replica_config_init - " @@ -164,12 +141,6 @@ replica_config_init() return -1; } - if ((rc = create_config_top()) != 0){ - slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "replica_config_init - " - "Failed to create top replication entry - error %d\n",rc); - } - - /* config DSE must be initialized before we get here */ slapi_config_register_callback(SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, CONFIG_BASE, LDAP_SCOPE_SUBTREE, CONFIG_FILTER, replica_config_add, NULL); -- 2.9.5