Explorar el Código

Ticket 477779 - Need to lock server list when removing list

Description:  Need to hold the write lock when deleting the server list.
              There is no need to lock the list in the close function,
              as all active threads should be stopped.  In 1.3.3, the
              dynamic plugin feature will also safely handle the plugin
              shutdown.

https://fedorahosted.org/389/ticket/47779

Reviewed by: tbordaz(Thanks!)
Mark Reynolds hace 11 años
padre
commit
2b98dcaf83
Se han modificado 1 ficheros con 5 adiciones y 3 borrados
  1. 5 3
      ldap/servers/plugins/dna/dna.c

+ 5 - 3
ldap/servers/plugins/dna/dna.c

@@ -700,11 +700,9 @@ dna_load_shared_servers()
     struct dnaServer *server = NULL, *global_servers = NULL;
     PRCList *server_list = NULL;
     PRCList *config_list = NULL;
+    int freed_servers = 0;
     int ret = 0;
 
-    /* First free the existing list. */
-    dna_delete_global_servers();
-
     /* Now build the new list. */
     dna_write_lock();
     if (!PR_CLIST_IS_EMPTY(dna_global_config)) {
@@ -722,6 +720,10 @@ dna_load_shared_servers()
             }
 
             dna_server_write_lock();
+            if(!freed_servers){
+                dna_delete_global_servers();
+                freed_servers = 1;
+            }
             if (shared_list) {
                 server_list = PR_LIST_HEAD(shared_list);
                 while (server_list != shared_list) {