#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;
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.");