s4-witness: allow to send multiple resource changes in witness_AsyncNotify().
authorGünther Deschner <gd@samba.org>
Sun, 27 Sep 2015 22:46:38 +0000 (00:46 +0200)
committerGünther Deschner <gd@samba.org>
Sun, 3 Feb 2019 09:33:39 +0000 (10:33 +0100)
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
source4/rpc_server/witness/dcesrv_witness.c

index a19bd6b3b146a647d2b0861100087fe56e240ca7..53a6dba30504455ab5c5a4027c256f23f771dfdc 100644 (file)
@@ -246,18 +246,21 @@ static void witness_AsyncNotify_done(struct tevent_req *subreq)
        }
 
        if (p->reg->PendingChangeNotifications != NULL) {
-               /* we need to process a LIST */
-               result = witness_create_notify_response(p,
-                                                       WITNESS_NOTIFY_RESOURCE_CHANGE,
-                                                       p->reg->PendingChangeNotifications->ResourceName,
-                                                       p->reg->PendingChangeNotifications->NewState,
-                                                       NULL,
-                                                       r->out.response);
-               if (!W_ERROR_IS_OK(result)) {
-                       r->out.result = result;
-                       goto reply;
+               struct ChangeNotification *reg;
+
+               for (reg = p->reg->PendingChangeNotifications; reg != NULL; reg = reg->next) {
+                       result = witness_create_notify_response(p,
+                                                               WITNESS_NOTIFY_RESOURCE_CHANGE,
+                                                               p->reg->PendingChangeNotifications->ResourceName,
+                                                               p->reg->PendingChangeNotifications->NewState,
+                                                               NULL,
+                                                               r->out.response);
+                       if (!W_ERROR_IS_OK(result)) {
+                               r->out.result = result;
+                               goto reply;
+                       }
+                       DLIST_REMOVE(p->reg->PendingChangeNotifications, reg);
                }
-               DLIST_REMOVE(p->reg->PendingChangeNotifications, p->reg->PendingChangeNotifications);
 
        } else if (p->reg->PendingMoveNotification != NULL) {
                /* we need to process ONE response */