Answering my own questions here, but for anyone else who's running Dovecot as a pop3/pop3s only server, with simple /var/spool/mail/mbox files, and no user home directories, here is a setup that works: default_mail_env = mbox:/var/dovecot/%n:INBOX=/var/spool/mail/%n:INDEX=/var/dovecot/%n This seems a little counter-intuitive, but it works. The pop3 locking error can be modified in src/pop3/client.c to be more appropriate. The error can be made conditional on the type of lock/storage error returned, but I'm not much of a C programmer, so I won't post my code for that! :-) The lock timeout can be changed to 15 sec in the dovecot.conf so that pop locks don't cause 5 minute waits for users. Ken A Pacific.Net Ken A wrote:
Dovecot's pop server with pop3_lock_session = yes will wait 5 min, by default (lock_timeout = 300) and then say "-ERR No INBOX for user."
I think the error message should come back sooner and say something more appropriate, like "-ERR Mailbox is locked. Is another session active?". The error message is easy to change in src/pop3/client.c. The problem then is that the mailbox file may not exist if this is a new user.
I also found that dovecot will create a directory if no mbox file exists yet. This causes "Internal error occurred" messages in the log, since the mbox should be a plain file, not a directory.
I might have something wrong in my dovecot.conf file that is causing this though. Here's my "default_mail_env" line:
default_mail_env = mbox:/var/spool/mail/%n:INBOX=/var/spool/mail/%n:INDEX=/dovecot_indexes/%n
Any ideas?
Thanks, Ken A Pacific.Net
Timo Sirainen wrote:
On Apr 13, 2006, at 2:42 AM, Ken A wrote:
# Keep the mailbox locked for the entire POP3 session. pop3_lock_session = yes
This doesn't seem to work yet. (linux, dovecot beta 7 with default locking)
Looks like I forgot one part of the code:
Index: src/master/mail-process.c =================================================================== RCS file: /var/lib/cvs/dovecot/src/master/mail-process.c,v retrieving revision 1.88 diff -u -r1.88 mail-process.c --- src/master/mail-process.c 12 Apr 2006 19:40:23 -0000 1.88 +++ src/master/mail-process.c 13 Apr 2006 00:54:28 -0000 @@ -241,6 +241,8 @@ env_put("POP3_REUSE_XUIDL=1"); if (set->pop3_enable_last) env_put("POP3_ENABLE_LAST=1"); + if (set->pop3_lock_session) + env_put("POP3_LOCK_SESSION=1"); if (set->mbox_dirty_syncs) env_put("MBOX_DIRTY_SYNCS=1"); if (set->mbox_very_dirty_syncs)
I can telnet to the server, login and then hit it with a normal pop3 client and I'm still able to download mail. I'd expect to see an error message "Mailbox locked, Is another session active?"
Currently it just waits a couple of minutes for the lock and then gives some error message.