[Dovecot] tilde in mbox:, when used in non-system user db

Michal Soltys nozo at ziu.info
Thu Mar 22 10:11:32 EET 2007


Originally I've thought that this is related to INBOX field,
but it turned out it happens only when you specify mbox.

Consider following passwd-file:

testms::10000:10000:imap,,,:/home/vmail/ppgk.com.pl/testms/./::userdb_mail=mbox:~/Mail:INBOX=/home/vmail/ppgk.com.pl/%u/inbox

or following line from userdb static:

args = uid=10000 gid=10000 home=/home/vmail/ppgk.com.pl/%u/./ mail=mbox:~/Mail:INBOX=/home/vmail/ppgk.com.pl/%u/inbox

In both cases, in user's directory, there will be an empty ~/Mail directory
created, in addition to Mail and inbox. No idea about how sql or ldap
would behave here, but global mail_location from dovecot.conf doesn't
suffer from this issue (~ was expanded properly in ktrace dump).

Chroot specification (/./) doesn't matter here.

If I change mbox:~/Mail:INBOX=..... to

mbox:/home/vmail/ppgk.com.pl/%u/Mail:INBOX=~/inbox

then everything will be fine - no extra '~' dir. Thus my assumption it's
not INBOX field related.

Looking at ktrace, it seems that imap process is checking for the existence
of ~/Mail, without expanding tilde. Then quite a bit later, it creates
Mail as a "side effect" of creating Trash subdirectory.

Relevant fragments:

   1853 imap     CALL  mkdir(0x8a79b100,0x1f8)
   1853 imap     NAMI  "~/Mail"
   1853 imap     RET   mkdir -1 errno 2 No such file or directory
   1853 imap     CALL  sigprocmask(0x1,0xffffffff)
   1853 imap     RET   sigprocmask 0
   1853 imap     CALL  mprotect(0x3c0ec000,0x1000,0x3)
   1853 imap     RET   mprotect 0
   1853 imap     CALL  mprotect(0x3c0ec000,0x1000,0x1)
   1853 imap     RET   mprotect 0
   1853 imap     CALL  sigprocmask(0x3,0)
   1853 imap     RET   sigprocmask -65793/0xfffefeff
   1853 imap     CALL  mkdir(0x8a79b108,0x1f8)
   1853 imap     NAMI  "~"
   1853 imap     RET   mkdir 0
   1853 imap     CALL  mkdir(0x8a79b100,0x1f8)
   1853 imap     NAMI  "~/Mail"
   1853 imap     RET   mkdir 0

and

   1853 imap     CALL  stat(0x8a79b180,0xcfbeb5c0)
   1853 imap     NAMI  "/home/vmail/ppgk.com.pl/testms/Mail/Trash"
   1853 imap     RET   stat -1 errno 2 No such file or directory
   1853 imap     CALL  stat(0x8a79b1b0,0xcfbeb600)
   1853 imap     NAMI  "/home/vmail/ppgk.com.pl/testms/Mail/Trash"
   1853 imap     RET   stat -1 errno 2 No such file or directory
   1853 imap     CALL  mkdir(0x8a79b1e0,0x1f8)
   1853 imap     NAMI  "/home/vmail/ppgk.com.pl/testms/Mail"
   1853 imap     RET   mkdir 0
   1853 imap     CALL  open(0x8a79b1b0,0xa02,0x1b0)
   1853 imap     NAMI  "/home/vmail/ppgk.com.pl/testms/Mail/Trash"
   1853 imap     RET   open 7



My configuration is prtty much the same as previously:

openbsd 3.9, i386, dovecot 1.0-rc27 (latest nightly, but the same happened in stock 1.0rc27)

dovecot.userdb:
testms::10000:10000:imap,,,:/home/vmail/ppgk.com.pl/testms/./::userdb_mail=mbox:~/Mail:INBOX=/home/vmail/ppgk.com.pl/%u/inbox

dovecot.passdb:
testms:{PLAIN}test:

base_dir: /var/dovecot/
protocols: imap imaps pop3 pop3s
ssl_listen: *
ssl_ca_file: /etc/ssl/cert_bundle.pem
ssl_cert_file: /etc/ssl/ca_ppgk/certs/fetch_crt.pem
ssl_key_file: /etc/ssl/ca_ppgk/private/fetch_key.pem
verbose_ssl: yes
login_dir: /var/dovecot/login
login_executable(default): /usr/local/libexec/dovecot/imap-login
login_executable(imap): /usr/local/libexec/dovecot/imap-login
login_executable(pop3): /usr/local/libexec/dovecot/pop3-login
login_greeting: Dovecot IMAP server ready.
login_greeting_capability(default): yes
login_greeting_capability(imap): yes
login_greeting_capability(pop3): no
valid_chroot_dirs: /var/mail:/home/regular:/home/vmail
verbose_proctitle: yes
first_valid_uid: 1999
first_valid_gid: 10
mail_location: mbox:~/Mail:INBOX=/var/mail/%u
mail_debug: yes
fsync_disable: yes
lock_method: fcntl
maildir_copy_with_hardlinks: yes
mbox_read_locks: fcntl
mbox_write_locks: fcntl
mail_executable(default): /usr/local/libexec/dovecot/imap
mail_executable(imap): /usr/local/libexec/dovecot/imap
mail_executable(pop3): /usr/local/libexec/dovecot/pop3
mail_plugin_dir(default): /usr/local/lib/dovecot/imap
mail_plugin_dir(imap): /usr/local/lib/dovecot/imap
mail_plugin_dir(pop3): /usr/local/lib/dovecot/pop3
imap_client_workarounds(default): outlook-idle delay-newmail
imap_client_workarounds(imap): outlook-idle delay-newmail
imap_client_workarounds(pop3): outlook-idle
pop3_uidl_format(default):
pop3_uidl_format(imap):
pop3_uidl_format(pop3): %08Xu%08Xv
pop3_client_workarounds(default):
pop3_client_workarounds(imap):
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh
auth default:
    mechanisms: plain login
    verbose: yes
    debug: yes
    passdb:
      driver: passwd-file
      args: /etc/dovecot.passdb
    passdb:
      driver: bsdauth
    userdb:
      driver: passwd-file
      args: /etc/dovecot.userdb
    userdb:
      driver: passwd
    socket:
      type: listen
      client:
        path: /var/spool/postfix/private/auth
        mode: 432
        user: postfix
        group: postfix
      master:



More information about the dovecot mailing list