Mercurial > dovecot > core-2.2
changeset 12228:39ef52bc4999
dsync: Fail if both source and destination mail location point to same directory.
This should prevent some accidents.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 01 Oct 2010 19:09:29 +0100 |
parents | 7c4e4a6b1714 |
children | da9185d1309c |
files | src/dsync/dsync.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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) {