]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
replicator: Remove user from replication if NOREPLICATE error is returned
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 27 Dec 2017 12:07:30 +0000 (14:07 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 5 Jan 2018 15:54:15 +0000 (17:54 +0200)
src/replication/replicator/dsync-client.c
src/replication/replicator/dsync-client.h
src/replication/replicator/replicator-brain.c

index 97f62d5f0e68a80c40cbf634e9fa8aab2a5868f3..5e23fc39525a4f389617e7563feeeee739e8b924 100644 (file)
@@ -132,6 +132,8 @@ static int dsync_input_line(struct dsync_client *client, const char *line)
        else if (line[0] == '-') {
                if (strcmp(line+1, "NOUSER") == 0)
                        dsync_callback(client, "", DSYNC_REPLY_NOUSER);
+               else if (strcmp(line+1, "NOREPLICATE") == 0)
+                       dsync_callback(client, "", DSYNC_REPLY_NOREPLICATE);
                else
                        dsync_callback(client, "", DSYNC_REPLY_FAIL);
        } else {
index 402c00198a898b191f21c138041017e9db35a488..c55b815bbf570737bab9948cf10712005ea98495 100644 (file)
@@ -6,7 +6,8 @@ struct dsync_client;
 enum dsync_reply {
        DSYNC_REPLY_OK,
        DSYNC_REPLY_FAIL,
-       DSYNC_REPLY_NOUSER
+       DSYNC_REPLY_NOUSER,
+       DSYNC_REPLY_NOREPLICATE,
 };
 
 enum dsync_type {
index f23877c7fd19ef7dc30a332c11bf74c88c0dab79..4917ab85499f33858ec880ef825db704fda76f10 100644 (file)
@@ -111,8 +111,10 @@ static void dsync_callback(enum dsync_reply reply, const char *state,
 
        if (!replicator_user_unref(&user)) {
                /* user was already removed */
-       } else if (reply == DSYNC_REPLY_NOUSER) {
-               /* user no longer exists, remove from replication */
+       } else if (reply == DSYNC_REPLY_NOUSER ||
+                  reply == DSYNC_REPLY_NOREPLICATE) {
+               /* user no longer exists, or is not wanted for replication,
+                  remove from replication */
                replicator_queue_remove(ctx->brain->queue, &ctx->user);
        } else {
                i_free(ctx->user->state);