From: Aki Tuomi Date: Wed, 27 Dec 2017 12:07:30 +0000 (+0200) Subject: replicator: Remove user from replication if NOREPLICATE error is returned X-Git-Tag: 2.3.9~2548 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c62d29c66b504ad3676deaefdf9e95f54e4f8eec;p=thirdparty%2Fdovecot%2Fcore.git replicator: Remove user from replication if NOREPLICATE error is returned --- diff --git a/src/replication/replicator/dsync-client.c b/src/replication/replicator/dsync-client.c index 97f62d5f0e..5e23fc3952 100644 --- a/src/replication/replicator/dsync-client.c +++ b/src/replication/replicator/dsync-client.c @@ -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 { diff --git a/src/replication/replicator/dsync-client.h b/src/replication/replicator/dsync-client.h index 402c00198a..c55b815bbf 100644 --- a/src/replication/replicator/dsync-client.h +++ b/src/replication/replicator/dsync-client.h @@ -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 { diff --git a/src/replication/replicator/replicator-brain.c b/src/replication/replicator/replicator-brain.c index f23877c7fd..4917ab8549 100644 --- a/src/replication/replicator/replicator-brain.c +++ b/src/replication/replicator/replicator-brain.c @@ -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);