dovecot-2.2: lib-storage: If trying to rename mailbox over itsel...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 28 00:11:34 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/35b9e155f03f
changeset: 15165:35b9e155f03f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 28 00:00:16 2012 +0300
description:
lib-storage: If trying to rename mailbox over itself, fail early.

diffstat:

 src/lib-storage/mail-storage.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r e3639ddbba2f -r 35b9e155f03f src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Thu Sep 27 23:58:54 2012 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Sep 28 00:00:16 2012 +0300
@@ -1320,6 +1320,11 @@
 			"Renaming not supported across non-private namespaces.");
 		return -1;
 	}
+	if (src->list == dest->list && strcmp(src->name, dest->name) == 0) {
+		mail_storage_set_error(src->storage, MAIL_ERROR_EXISTS,
+				       "Can't rename mailbox to itself.");
+		return -1;
+	}
 
 	return src->v.rename_box(src, dest);
 }


More information about the dovecot-cvs mailing list