dovecot-2.2: doveadm backup -R: Open the mailbox as readonly, so...

dovecot at dovecot.org dovecot at dovecot.org
Tue Mar 3 17:35:44 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/ef0bfe110ed9
changeset: 18286:ef0bfe110ed9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Mar 03 19:32:28 2015 +0200
description:
doveadm backup -R: Open the mailbox as readonly, so with imapc EXAMINE is used.

diffstat:

 src/doveadm/dsync/dsync-brain-mailbox.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 31c0b82250b6 -r ef0bfe110ed9 src/doveadm/dsync/dsync-brain-mailbox.c
--- a/src/doveadm/dsync/dsync-brain-mailbox.c	Tue Mar 03 17:25:33 2015 +0200
+++ b/src/doveadm/dsync/dsync-brain-mailbox.c	Tue Mar 03 19:32:28 2015 +0200
@@ -14,15 +14,22 @@
 #include "dsync-brain-private.h"
 
 static int
-ns_mailbox_try_alloc(struct mail_namespace *ns, const guid_128_t guid,
-		     struct mailbox **box_r, const char **error_r)
+ns_mailbox_try_alloc(struct dsync_brain *brain, struct mail_namespace *ns,
+		     const guid_128_t guid, struct mailbox **box_r,
+		     const char **error_r)
 {
+	enum mailbox_flags flags = 0;
 	struct mailbox *box;
 	enum mailbox_existence existence;
 	enum mail_error err;
 	int ret;
 
-	box = mailbox_alloc_guid(ns->list, guid, 0);
+	if (brain->backup_send) {
+		/* make sure mailbox isn't modified */
+		flags |= MAILBOX_FLAG_READONLY;
+	}
+
+	box = mailbox_alloc_guid(ns->list, guid, flags);
 	ret = mailbox_exists(box, FALSE, &existence);
 	if (ret < 0) {
 		*error_r = mailbox_get_last_error(box, &err);
@@ -51,7 +58,7 @@
 	for (ns = brain->user->namespaces; ns != NULL; ns = ns->next) {
 		if (!dsync_brain_want_namespace(brain, ns))
 			continue;
-		if ((ret = ns_mailbox_try_alloc(ns, guid, box_r, error_r)) != 0) {
+		if ((ret = ns_mailbox_try_alloc(brain, ns, guid, box_r, error_r)) != 0) {
 			if (ret < 0)
 				brain->failed = TRUE;
 			return ret;


More information about the dovecot-cvs mailing list