]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Added extra asserts
authorTimo Sirainen <tss@iki.fi>
Mon, 3 Feb 2014 16:50:10 +0000 (11:50 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 3 Feb 2014 16:50:10 +0000 (11:50 -0500)
src/doveadm/dsync/dsync-mailbox-tree-sync.c

index abb42391f431bc89ca52753b3c4b54eb512ccc5f..552b9af466ef557b4986a00e9dae44d27c3e7b25 100644 (file)
@@ -88,6 +88,8 @@ sync_add_dir_change(struct dsync_mailbox_tree_sync_ctx *ctx,
        struct dsync_mailbox_tree_sync_change *change;
        const char *name;
 
+       i_assert(ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL);
+
        name = dsync_mailbox_node_get_full_name(ctx->local_tree, node);
 
        change = array_append_space(&ctx->changes);
@@ -102,6 +104,8 @@ sync_add_create_change(struct dsync_mailbox_tree_sync_ctx *ctx,
 {
        struct dsync_mailbox_tree_sync_change *change;
 
+       i_assert(ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL);
+
        change = array_append_space(&ctx->changes);
        change->type = DSYNC_MAILBOX_TREE_SYNC_TYPE_CREATE_BOX;
        change->ns = node->ns;
@@ -162,6 +166,7 @@ sync_delete_mailbox_node(struct dsync_mailbox_tree_sync_ctx *ctx,
 
        if (tree == ctx->local_tree) {
                /* delete this mailbox locally */
+               i_assert(ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL);
                change = array_append_space(&ctx->changes);
                change->type = DSYNC_MAILBOX_TREE_SYNC_TYPE_DELETE_BOX;
                change->ns = node->ns;
@@ -393,6 +398,7 @@ sync_rename_node_to_temp(struct dsync_mailbox_tree_sync_ctx *ctx,
                /* we're modifying a local tree. remember this change. */
                new_name = dsync_mailbox_node_get_full_name(tree, node);
 
+               i_assert(ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL);
                i_assert(strcmp(old_name, "INBOX") != 0);
                change = array_append_space(&ctx->changes);
                change->type = DSYNC_MAILBOX_TREE_SYNC_TYPE_RENAME;
@@ -460,6 +466,7 @@ sync_rename_node(struct dsync_mailbox_tree_sync_ctx *ctx,
                /* we're modifying a local tree. remember this change. */
                other_name = dsync_mailbox_node_get_full_name(other_tree, other_node);
 
+               i_assert(ctx->sync_type != DSYNC_MAILBOX_TREES_SYNC_TYPE_PRESERVE_LOCAL);
                i_assert(strcmp(name, "INBOX") != 0);
                change = array_append_space(&ctx->changes);
                change->type = DSYNC_MAILBOX_TREE_SYNC_TYPE_RENAME;