]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm-dsync: Do not attempt to sync noreplicate user
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 28 May 2019 07:40:15 +0000 (10:40 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 28 May 2019 07:52:53 +0000 (10:52 +0300)
src/doveadm/doveadm-dsync.c

index b0c057e182a253c92e4a7d384968867568fb8123..3bac6e05401a68da8c3f91e0f0e04e56fae96343 100644 (file)
@@ -578,10 +578,19 @@ cmd_dsync_run(struct doveadm_mail_cmd_context *_ctx, struct mail_user *user)
        enum dsync_brain_flags brain_flags;
        enum mail_error mail_error = 0, mail_error2;
        bool remote_errors_logged = FALSE;
+       bool cli = (cctx->conn_type == DOVEADM_CONNECTION_TYPE_CLI);
        const char *changes_during_sync, *changes_during_sync2 = NULL;
        bool remote_only_changes;
        int ret = 0;
 
+       /* replicator_notify indicates here automated attempt,
+          we still want to allow manual sync/backup */
+       if (!cli && ctx->replicator_notify &&
+           mail_user_plugin_getenv_bool(_ctx->cur_mail_user, "noreplicate")) {
+               ctx->ctx.exit_code = DOVEADM_EX_NOREPLICATE;
+               return -1;
+       }
+
        i_zero(&set);
        if (cctx->remote_ip.family != 0) {
                /* include the doveadm client's IP address in the ps output */