]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
IMAP: Don't allow APPEND to specify INTERNALDATE more than 2 hours into future.
authorTimo Sirainen <tss@iki.fi>
Fri, 3 Apr 2009 16:41:56 +0000 (12:41 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 3 Apr 2009 16:41:56 +0000 (12:41 -0400)
--HG--
branch : HEAD

src/imap/cmd-append.c

index 8042e55d7c7ec22205bcce49da7e7dd63b326acd..390a01ff8bfc7811ea92c21234dde66ac090e016 100644 (file)
 
 #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;
         struct client_command_context *cmd;
@@ -321,6 +327,13 @@ static bool cmd_append_continue_parsing(struct client_command_context *cmd)
                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.");