What mailbox format are you using?

One very obvious way that this problem could be caused is if your system uses traditional UNIX mailbox format with a delivery program that writes a "From " header in UTC without a timezone, e.g.,
        From fred Fri Aug 26 15:56:46 2005

Since the timezone is missing, UW imapd's parsing code assumes that the time is in the local timezone. On every UNIX system that I've seen so far, that assumption would be correct.

Are you delivering directly from procmail? Or, is procmail calling some program such as /bin/mail, /bin/mail.local, etc. for final delivery?

There are three ways that you can get around it.

The first is to replace the delivery program with a program (such as the UW IMAP toolkit's tmail or dmail) that writes POSIX-style dates that include a timezone, e.g.,
        From fred Fri Aug 26 10:56:46 2005 -0500

Although this is what I would recommend, a problem with doing this is that there are some ancient UNIX programs which choke on POSIX-style dates.

Alternatively, you can change the traditional UNIX mailbox format's default handling of timezone by editing imap-????/src/osdep/unix/unix.c to change the string "LCL" to be "GMT" in the statement:
                                /* zzz */
        t = zn ? (t + zn + 1) : (unsigned char *) "LCL";

Finally, you can look into why your delivery program is writing UTC date/time in the From without a timestamp, and get it to either write the date/time in local time or to write a POSIX-style date with a timestamp.


One last thing...

Since you mentioned qmail; if you use maildir format with a third-party maildir driver in UW imapd, then this is probably a bug in that driver. I can't say for sure what's wrong (I don't pretend to support maildir), but the following may help:

You need to find out how it determines the internaldate. If it sets the internaldate from the file mtime, make sure that it does something like:
      struct tm *tm = gmtime (&sbuf.st_mtime);
      elt->day = tm->tm_mday; elt->month = tm->tm_mon + 1;
      elt->year = tm->tm_year + 1900 - BASEYEAR;
      elt->hours = tm->tm_hour; elt->minutes = tm->tm_min;
      elt->seconds = tm->tm_sec;
      elt->zhours = 0; elt->zminutes = 0;

The setting of zhours and zminutes to zero makes it be UTC.

If the maildir driver uses localtime(), make sure that it calculates the timezone offset using a delta from the gmtime() value and *NOT* the timezone values in the returned struct tm. Look at phile.c to see how this is done.

The reason that you have to do this is that localtime() depends upon environment that isn't always completely set up for daemons; thus you can get localtime() returning a struct tm with the correct timezone offset but the time being UTC! Calculating the delta with gmtime() avoids this.

-- Mark --

http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.
_______________________________________________
Imap-uw mailing list
[email protected]
https://mailman1.u.washington.edu/mailman/listinfo/imap-uw

Reply via email to