From aa0588ee576d75ac6802c1775a5aa7558957ab48 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Apr 30 2015 19:35:38 +0000 Subject: Ticket 48177 - dynamic plugins should not return an error when modifying a critical plugin Bug Description: When dynamic plugins are enabled, any update to a "critical" plugin is rejected. Fix Description: The operation should still be allowed, even though the change might not be dynamically applied. Log an error instead stating that a restart might be required. https://fedorahosted.org/389/ticket/48177 Reviewed by: rmeggins(Thanks!) --- diff --git a/dirsrvtests/suites/dynamic-plugins/test_dynamic_plugins.py b/dirsrvtests/suites/dynamic-plugins/test_dynamic_plugins.py index 6567f47..26f4225 100644 --- a/dirsrvtests/suites/dynamic-plugins/test_dynamic_plugins.py +++ b/dirsrvtests/suites/dynamic-plugins/test_dynamic_plugins.py @@ -111,6 +111,13 @@ def test_dynamic_plugins(topology): ldap.fatal('Failed to enable dynamic plugin!' + e.message['desc']) assert False + # Test that critical plugins can be updated even though the change might not be applied + try: + topology.standalone.modify_s(DN_LDBM, [(ldap.MOD_REPLACE, 'description', 'test')]) + except ldap.LDAPError, e: + ldap.fatal('Failed to apply change to critical plugin' + e.message['desc']) + assert False + while 1: # # First run the tests with replication disabled, then rerun them with replication set up diff --git a/ldap/servers/slapd/plugin.c b/ldap/servers/slapd/plugin.c index 2b3428e..e54c01d 100644 --- a/ldap/servers/slapd/plugin.c +++ b/ldap/servers/slapd/plugin.c @@ -2308,12 +2308,15 @@ plugin_restart(Slapi_Entry *pentryBefore, Slapi_Entry *pentryAfter) char returntext[SLAPI_DSE_RETURNTEXT_SIZE]; int rc = LDAP_SUCCESS; - /* We can not restart the critical plugins */ + /* + * We can not restart a critical plugin, but the operation should still + * be allowed + */ if(plugin_is_critical(pentryBefore)){ - LDAPDebug(LDAP_DEBUG_PLUGIN, "plugin_restart: Plugin (%s) is critical to server operation. " - "Any changes will not take effect until the server is restarted.\n", - slapi_entry_get_dn(pentryBefore),0,0); - return 1; /* failure - dse code will log a fatal message */ + LDAPDebug(LDAP_DEBUG_ANY, "plugin_restart: Plugin (%s) is critical " + "to server operation. Server requires restart for changes to " + "take effect.\n", slapi_entry_get_dn(pentryBefore),0,0); + return 0; } slapi_rwlock_wrlock(global_rwlock);