dovecot-1.2: IMAP: Don't allow APPEND to specify INTERNALDATE mo...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 3 19:42:02 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/3c33885a717a
changeset: 8906:3c33885a717a
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 03 12:41:56 2009 -0400
description:
IMAP: Don't allow APPEND to specify INTERNALDATE more than 2 hours into future.

diffstat:

1 file changed, 13 insertions(+)
src/imap/cmd-append.c |   13 +++++++++++++

diffs (30 lines):

diff -r b567f5f42b3d -r 3c33885a717a src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Fri Apr 03 12:35:02 2009 -0400
+++ b/src/imap/cmd-append.c	Fri Apr 03 12:41:56 2009 -0400
@@ -11,6 +11,12 @@
 #include "mail-storage.h"
 
 #include <sys/time.h>
+
+/* Don't allow internaldates to be too far in the future. At least with Maildir
+   they can cause problems with incremental backups since internaldate is
+   stored in file's mtime. But perhaps there are also some other reasons why
+   it might not be wanted. */
+#define INTERNALDATE_MAX_FUTURE_SECS (2*3600)
 
 struct cmd_append_context {
 	struct client *client;
@@ -321,6 +327,13 @@ static bool cmd_append_continue_parsing(
 		return cmd_append_cancel(ctx, nonsync);
 	}
 
+	if (internal_date != (time_t)-1 &&
+	    internal_date > ioloop_time + INTERNALDATE_MAX_FUTURE_SECS) {
+		/* the client specified a time in the future, set it to now. */
+		internal_date = (time_t)-1;
+		timezone_offset = 0;
+	}
+
 	if (ctx->msg_size == 0) {
 		/* no message data, abort */
 		client_send_tagline(cmd, "NO Can't save a zero byte message.");


More information about the dovecot-cvs mailing list