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

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


details:   http://hg.dovecot.org/dovecot-1.1/rev/f6d86da96608
changeset: 8234:f6d86da96608
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 03 12:41:33 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 34d6b5b7864b -r f6d86da96608 src/imap/cmd-append.c
--- a/src/imap/cmd-append.c	Thu Apr 02 14:25:27 2009 -0400
+++ b/src/imap/cmd-append.c	Fri Apr 03 12:41:33 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;
@@ -319,6 +325,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