2004-02-23 18:32

Ugly hack at noon

I just spent the afternoon at a client's hacking qmail+courier to work storing mail on a NT server.

Why? Well, migration issues, from NT to Linux.

And what had to be hacked? Lots.

  • You can't chmod over SMB
  • You can't link() over SMB (you can unlink(), though), so in order to have atomic message moves from Maildir/tmp to Maildir/new and whatever, rename()
  • Good thing this was a single-UID qmail system: you can't chown either ;-)
  • Courier's metadata is created on Maildir/tmp and moved: same problem as above
  • Cranky permission checks fixed via uid,gid,fmask mount options.
  • It had to work with a canned webmail thing, which expects all mail to be in one folder on disk, so Maildir/cur and Maildir/new have to be symlinks to a single folder.
  • Since you can't have symlinks on SMB, Maildir is local, but subdirs of it are symlinks to the SMB-mounted thing
  • Then courier's pop doesn't work because you can't rename from Maildir/tmp (over SMB) to maildir/courierpopwhatever (local), so hack courier to use mkstemp or whatever
  • Then courier got each mail twice. Looks like it sees two UIDLs for the same file, depending on whether it's read or not (my guess: because we are mixing Maildir/cur and Maildir/new on one folder). Make courier use alternative UIDL format and it works.

And so on. About two hours, and I am pretty sure noone has ever done something like this before. On the other hand, when noone has done something like this before, they usually had a very good reason!


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina