dovecot-2.0: dsync: Fail if both source and destination mail loc...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 1 21:09:33 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/39ef52bc4999
changeset: 12228:39ef52bc4999
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 01 19:09:29 2010 +0100
description:
dsync: Fail if both source and destination mail location point to same directory.
This should prevent some accidents.
diffstat:
src/dsync/dsync.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (26 lines):
diff -r 7c4e4a6b1714 -r 39ef52bc4999 src/dsync/dsync.c
--- a/src/dsync/dsync.c Fri Oct 01 18:58:47 2010 +0100
+++ b/src/dsync/dsync.c Fri Oct 01 19:09:29 2010 +0100
@@ -160,6 +160,7 @@
struct dsync_worker *worker1, *worker2, *workertmp;
const char *error, *username, *cmd_name, *mailbox = NULL;
const char *local_location = NULL, *const *remote_cmd_args = NULL;
+ const char *path1, *path2;
bool dsync_server = FALSE, unexpected_changes = FALSE;
bool dsync_debug = FALSE, reverse_workers = FALSE;
char alt_char = '_';
@@ -277,6 +278,14 @@
"virtual mailbox hierarchy separator "
"(specify separator for the default namespace)");
}
+ path1 = mailbox_list_get_path(mail_user->namespaces->list, NULL,
+ MAILBOX_LIST_PATH_TYPE_MAILBOX);
+ path2 = mailbox_list_get_path(mail_user2->namespaces->list, NULL,
+ MAILBOX_LIST_PATH_TYPE_MAILBOX);
+ if (strcmp(path1, path2) == 0) {
+ i_fatal("Both source and destination mail_location "
+ "points to same directory: %s", path1);
+ }
worker2 = dsync_worker_init_local(mail_user2, alt_char);
if (reverse_workers) {
More information about the dovecot-cvs
mailing list