]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Add NOREPLICATE error when "noreplicate" user flag is used
authorAki Tuomi <aki.tuomi@dovecot.fi>
Wed, 27 Dec 2017 12:08:13 +0000 (14:08 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 5 Jan 2018 15:54:15 +0000 (17:54 +0200)
It will be only understood if -U flag has been used

src/doveadm/client-connection-tcp.c
src/doveadm/doveadm-dsync.c
src/doveadm/doveadm.h

index 4c8eead869a283d16cdb8fa1ea8bd32aa51d1938..fad7edb2f29093d0ea9810afcfdb170d46751e01 100644 (file)
@@ -290,6 +290,8 @@ doveadm_mail_cmd_server_run(struct client_connection_tcp *conn,
                o_stream_nsend(conn->output, "\n-\n", 3);
        } else if (ret == 0) {
                o_stream_nsend_str(conn->output, "\n-NOUSER\n");
+       } else if (mctx->exit_code == DOVEADM_EX_NOREPLICATE) {
+               o_stream_nsend_str(conn->output, "\n-NOREPLICATE\n");
        } else if (mctx->exit_code != 0) {
                /* maybe not an error, but not a full success either */
                o_stream_nsend_str(conn->output,
index e5387d86c2734ec8067ff7d02e2eefb20e8e5d58..9c73393407c4a41d311a41c392229374dee0959c 100644 (file)
@@ -1154,6 +1154,11 @@ cmd_dsync_server_run(struct doveadm_mail_cmd_context *_ctx,
        enum mail_error mail_error;
 
        if (!cli) {
+               if (ctx->replicator_notify &&
+                   mail_user_plugin_getenv_bool(_ctx->cur_mail_user, "noreplicate")) {
+                       return DOVEADM_EX_NOREPLICATE;
+               }
+
                /* doveadm-server connection. start with a success reply.
                   after that follows the regular dsync protocol. */
                ctx->fd_in = ctx->fd_out = -1;
index 7f09681b868b4737d0ab01a0034d57be71bb40d0..428a291bc3f386c722147fe37b54d2db23df4961 100644 (file)
@@ -11,6 +11,8 @@
 #define DOVEADM_EX_NOTPOSSIBLE EX_DATAERR
 #define DOVEADM_EX_UNKNOWN -1
 
+#define DOVEADM_EX_NOREPLICATE 1001
+
 enum doveadm_client_type {
        DOVEADM_CONNECTION_TYPE_CLI = 0,
        DOVEADM_CONNECTION_TYPE_TCP,