Răsfoiți Sursa

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!)
Mark Reynolds 10 ani în urmă
părinte
comite
aa0588ee57

+ 7 - 0
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

+ 8 - 5
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);