[Dovecot] Problem with INTERNALDATE when the year in localtime and GMT different
In my thought utc_offset function in src/lib/utc-offset.c returns wrong offset value when the year in localtime and GMT different.
/* max offset of 24 hours */ if (ltm.tm_yday < gtm.tm_yday) offset = -24 * 60; else if (ltm.tm_yday > gtm.tm_yday) offset = 24 * 60; else offset = 0;
I think this code should be modified as followings.
/* max offset of 24 hours */ if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday < gtm.tm_yday) || (ltm.tm_year < gtm.tm_year)) offset = -24 * 60; else if ((ltm.tm_year == gtm.tm_year && ltm.tm_yday > gtm.tm_yday) || (ltm.tm_year > gtm.tm_year)) offset = 24 * 60; else offset = 0;
On 1 Jan. 2009, I found an error related to this code. The intrenal date of message recieved at 01-Jan-2009 07:17:38 was not display as it received. The protocol log was as followings.
FETCH (INTERNALDATE “01-Jan-2009 07:17:38 -3900” RFC822.SIZE 1597 FLAGS (\Seen) ENVELOP (“Thu, 1 Jan 2009 07:17:38 +0900 (KST)” …
The INTERNALDATE must be “01-Jan-2009 07:17:38 +0900”, but it was "01-Jan- 2009 07:17:38 -3900". This error may be caused by the bug in utc_offset.c.
How do you think?
On Tue, 2009-07-21 at 16:08 +0900, 도원철 wrote:
In my thought utc_offset function in src/lib/utc-offset.c returns wrong offset value when the year in localtime and GMT different. .. I think this code should be modified as followings.
Thanks, committed to hg. And I forgot to mention your name (well, email) in the commit message, sorry about that.
participants (2)
-
Timo Sirainen
-
도원철