[Dovecot] Weird internaldate behavior with 1.0-test80 and mbox folder

Timo Sirainen tss at iki.fi
Sun Aug 28 21:54:17 EEST 2005


On Tue, 2005-08-23 at 11:50 -0500, Jon Roma wrote:
> Has anyone else encountered weird date behavior with mbox-style folders?

Looks like timezone handling was completely broken in mboxes. I think
most people haven't noticed it because most software nowadays don't seem
to write timezones to the From-line.

This patch should fix it?

Index: src/lib-storage/index/mbox/mbox-from.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-from.c,v
retrieving revision 1.6
diff -u -r1.6 mbox-from.c
--- src/lib-storage/index/mbox/mbox-from.c	19 Aug 2005 15:49:49 -0000	1.6
+++ src/lib-storage/index/mbox/mbox-from.c	28 Aug 2005 18:52:29 -0000
@@ -145,8 +145,8 @@
 		   i_isdigit(msg[3]) && i_isdigit(msg[4]) && msg[5] == ' ') {
 		/* numeric timezone, use it */
                 seen_timezone = TRUE;
-		timezone = (msg[1]-'0') * 1000 + (msg[2]-'0') * 100 +
-			(msg[3]-'0') * 10 +(msg[4]-'0');
+		timezone = (msg[1]-'0') * 10*60*60 + (msg[2]-'0') * 60*60 +
+			(msg[3]-'0') * 10 + (msg[4]-'0');
 		if (msg[0] == '-') timezone = -timezone;
 		msg += 6;
 	}
@@ -166,8 +166,8 @@
 	    i_isdigit(msg[2]) && i_isdigit(msg[3]) &&
 	    i_isdigit(msg[4]) && i_isdigit(msg[5])) {
 		seen_timezone = TRUE;
-		timezone = (msg[2]-'0') * 1000 + (msg[3]-'0') * 100 +
-			(msg[4]-'0') * 10 +(msg[5]-'0');
+		timezone = (msg[2]-'0') * 10*60*60 + (msg[3]-'0') * 60*60 +
+			(msg[4]-'0') * 10 + (msg[5]-'0');
 		if (msg[1] == '-') timezone = -timezone;
 	}
 
@@ -176,7 +176,7 @@
 		if (t == (time_t)-1)
 			return -1;
 
-		t -= timezone * 60;
+		t -= timezone;
 		*time_r = t;
 	} else {
 		/* assume local timezone */

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20050828/e296876c/attachment.pgp


More information about the dovecot mailing list