The following issue has been SUBMITTED. 
====================================================================== 
http://dbmail.org/mantis/view.php?id=911 
====================================================================== 
Reported By:                brendan
Assigned To:                
====================================================================== 
Project:                    DBMail
Issue ID:                   911
Category:                   IMAP daemon
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
target:                      
====================================================================== 
Date Submitted:             29-Jul-11 01:22 CEST
Last Modified:              29-Jul-11 01:22 CEST
====================================================================== 
Summary:                    Messages saved with IMAP have incorrect internaldate
Description: 
We migrated one mailbox from our old system to DBMail 3.0 rc2 to test, and
found that all messages copied to it (with IMAP), and all new ones saved
using IMAP, have an internaldate 7 hours earlier than what each should be.
All new messages delivered by lmtpd are correct. The 7 hour difference
corresponds to our timezone PDT (-0700), but the time shown is neither UTC
nor PDT because UTC is 7 hours later than our time.

The problem seems to come from the use of strptime/strftime in
_ic_append_enter in imapcommands.c, which strips the -0700 portion of the
date string sent by the IMAP client when constructing sqltime, so the
message is saved with the localtime value as if it were UTC.

For our site I corrected it for the moment with the crude patch below. I
only tested it lightly so far, but g_mime_utils_header_decode_date (in
dbmail_message_set_internal_date in dbmail-message.c) seems to handle the
unmodified date just fine. I am sure you can fix it more cleanly.

*** imapcommands.c.old  2011-07-28 16:16:00.000000000 -0700
--- imapcommands.c      2011-07-28 16:14:51.000000000 -0700
***************
*** 1230,1236 ****
                dt = g_strstrip(dt);
  
                if (strptime(dt, "%d-%b-%Y %T", &tm) != NULL)
!                       strftime(sqldate, sizeof(sqldate), "%Y-%m-%d %H:%M:%S", 
&tm);
                else
                        sqldate[0] = '\0';
                /* internal date specified */
--- 1230,1236 ----
                dt = g_strstrip(dt);
  
                if (strptime(dt, "%d-%b-%Y %T", &tm) != NULL)
!                       strcpy(sqldate, dt);
                else
                        sqldate[0] = '\0';
                /* internal date specified */

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
29-Jul-11 01:22  brendan        New Issue                                    
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to