[Dovecot] Expire plugin: wrong mailbox separators in database?

Andreas Ntaflos daff at dword.org
Tue Sep 15 18:59:29 EEST 2009


Hi all, 

I'm experimenting with the expire plugin and seem have run into a small 
problem. I am using Dovecot 1.2.4 on a test server. The config is taken 
mostly verbatim from the expire plugin wiki page [1], using MySQL as a 
database. See below for detailed output.

Namespace "private" has "/" configured as mailbox separator:

namespace private {
    separator = /
    prefix =
    inbox = yes
}

The "expire =" section from dovecot.conf thus looks like this:

plugin {
    expire = Trash 7 INBOX/Spam 8 INBOX/Spam/To-Discard 3
    ...
}

Three mailboxes/folders are kept track of: Trash, INBOX/Spam and 
INBOX/Spam/Spam-To-Discard (this one holds messages that scored high 
enough to very unlikely be legitimate and should be deleted soon).

But when a message is put into one of these folders the mailbox 
attribute of the expires table uses "." as mailbox separator:

mysql> select * from expires;
+-----------------+----------------------------+--------------+
| username        | mailbox                    | expire_stamp |
+-----------------+----------------------------+--------------+
| foo at example.org | INBOX.Spam.Spam-To-Discard |   1253114526 |
| foo at example.org | INBOX.Spam                 |   1253114528 |
+-----------------+----------------------------+--------------+

Consequently, expire-tool --test seems to choke on this:

# dovecot --exec-mail ext /usr/local/libexec/dovecot/expire-tool --test
Info: foo at example.org/INBOX.Spam.Spam-To-Discard: \
    mailbox 'INBOX.Spam.Spam-To-Discard' removed from config
Info: foo at example.org/INBOX.Spam: mailbox 'INBOX.Spam' \
    removed from config

When I manually update the mailbox attribute to use "/" as separator 
expire-tool seems to work correctly:

# dovecot --exec-mail ext /usr/local/libexec/dovecot/expire-tool --test
Info: foo at example.org/INBOX/Spam/Spam-To-Discard: stop, expire \
    time in future: Wed Sep 16 17:22:06 2009

Using "." as separator in the "expire =" line doesn't work either: the 
expires table isn't written to at all when a message is put in one of 
the specified folders. Presumably because INBOX/Spam is the real 
mailbox but INBOX.Spam is monitored by the expire plugin and there is 
no INBOX.Spam to put in messages.

So I believe this is not the expected behaviour? Or am I doing anything 
wrong? I'd rather not change the separator from "/" to "." in all the 
namespaces if that can be avoided.

Thanks in advance, 

Andreas

dovecot -n:
==========

# 1.2.4: /usr/local/etc/dovecot.conf
# OS: Linux 2.6.26-2-686 i686 Debian 5.0.2
log_timestamp: %Y-%m-%d %H:%M:%S
protocols: managesieve imap imaps pop3 pop3s
listen: 83.65.168.220 127.0.0.1
login_dir: /usr/local/var/run/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_executable(managesieve): /usr/local/libexec/dovecot/managesieve-login
mail_access_groups: mail
mail_privileged_group: mail
mail_location: maildir:~/Maildir
mail_drop_priv_before_exec: yes
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_executable(managesieve): /usr/local/libexec/dovecot/managesieve
mail_plugins(default): autocreate acl expire
mail_plugins(imap): autocreate acl expire
mail_plugins(pop3): expire
mail_plugins(managesieve):
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
mail_plugin_dir(managesieve): /usr/local/lib/dovecot/managesieve
namespace:
  type: public
  separator: /
  prefix: Public/
  location: 
maildir:/var/mail/public:CONTROL=~/Maildir/control/public:INDEX=~/Maildir/index/public
  list: yes
namespace:
  type: private
  separator: /
  prefix: Backup/
  location: maildir:~/Maildir-backup
  hidden: yes
  list: no
namespace:
  type: private
  separator: /
  inbox: yes
  list: yes
  subscriptions: yes
lda:
  log_path:
  info_log_path:
  auth_socket_path: /var/run/dovecot/auth-master
  postmaster_address: postmaster at mailtest0.rise-s.com
  mail_plugins: sieve acl expire
auth default:
  mechanisms: plain login
  passdb:
    driver: pam
  passdb:
    driver: sql
    args: /etc/dovecot/dovecot-sql.conf
  userdb:
    driver: passwd
  userdb:
    driver: static
    args: uid=vmail gid=vmail home=/var/vmail/%Ld/%Ln 
allow_all_users=yes
  socket:
    type: listen
    client:
      path: /var/spool/postfix/private/auth
      mode: 432
      user: postfix
      group: postfix
    master:
      path: /var/run/dovecot/auth-master
      mode: 384
      user: vmail
plugin:
  expire: Trash 7 INBOX/Spam 5 INBOX/Spam/Spam-To-Discard 3
  expire_dict: proxy::expire
  sieve: ~/.dovecot.sieve
  sieve_dir: ~/sieve
  sieve_global_path: /etc/dovecot/sieve/default.sieve
  sieve_global_dir: /etc/dovecot/sieve/global/
  sieve_before: /etc/dovecot/sieve/before/
  autocreate: Trash
  autocreate2: Drafts
  autocreate3: Sent
  autocreate4: INBOX/Spam
  autocreate5: INBOX/Spam/Spam-To-Discard
  autosubscribe: Trash
  autosubscribe2: Drafts
  autosubscribe3: Sent
  autosubscribe4: INBOX/Spam
  autosubscribe5: INBOX/Spam/Spam-To-Discard
  acl: vfile:/etc/dovecot/acl
dict:
  expire: mysql:/etc/dovecot/dovecot-dict-expire.conf

/etc/dovecot/dovecot-dict-expire.conf:
=====================================

connect = host=127.0.0.1 dbname=mailserver user=mailuser password=xxx

map {
  pattern = shared/expire/$user/$mailbox
  table = expires
  value_field = expire_stamp

  fields {
    username = $user
    mailbox = $mailbox
  }
}

The expires table:

CREATE TABLE expires (
  username varchar(100) not null,
  mailbox varchar(255) not null,
  expire_stamp integer not null,
  primary key (username, mailbox)
);

[1] http://wiki.dovecot.org/Plugins/Expire
-- 
Andreas Ntaflos
Vienna, Austria

GPG Fingerprint: 6234 2E8E 5C81 C6CB E5EC  7E65 397C E2A8 090C A9B4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://dovecot.org/pipermail/dovecot/attachments/20090915/70fcae92/attachment.bin 


More information about the dovecot mailing list