Stephane Enten wrote:
Hello all,
I'm trying to understand when exactly the variable substitution happens in Dovecot, as I get different results in the LDA and in the POP/IMAP server.
Here's my general setup:
- Postfix MTA, delivers mail via Dovecot LDA
- users list sits in a database
- mail directory is stored in the database, but with Dovecot variables inside
Delivery works perfectly fine, Dovecot's deliver get a "mail" column from the database (that looks like this: /mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln/ ) and expands variables, delivers the mail into the maildir's location.
Now if I try to access the mailbox through Dovecot's POP/IMAP server, it looks like it gets the right field from the database, but won't expand the variables:
May 24 18:31:14 mail1 dovecot: imap-login: Login: user=<XXXXX>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured May 24 18:31:14 mail1 dovecot: IMAP(XXXXX): Effective uid=1021, gid=304, home= May 24 18:31:14 mail1 dovecot: IMAP(XXXXX): maildir: data=/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln/ May 24 18:31:14 mail1 dovecot: IMAP(XXXXX): maildir: root=/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln, index=/srv/mail/01/%2LMd /%2.2LMd/%LMd/mail/%Ln, control=, inbox= May 24 18:31:14 wmail1-v dovecot: IMAP(XXXXX): Disconnected
Am I missing something to get the pop/imap part expand those ?
# /etc/dovecot/dovecot.conf log_timestamp: %Y-%m-%d %H:%M:%S protocols: pop3 pop3s imap imaps disable_plaintext_auth: no shutdown_clients: no login_dir: /var/run/dovecot/login login_executable(default): /usr/lib/dovecot/imap-login login_executable(imap): /usr/lib/dovecot/imap-login login_executable(pop3): /usr/lib/dovecot/pop3-login login_process_per_connection: no login_processes_count: 5 verbose_proctitle: yes first_valid_uid: 1000 mail_debug: yes maildir_copy_with_hardlinks: yes mail_executable(default): /usr/lib/dovecot/imap mail_executable(imap): /usr/lib/dovecot/imap mail_executable(pop3): /usr/lib/dovecot/pop3 mail_plugin_dir(default): /usr/lib/dovecot/modules/imap mail_plugin_dir(imap): /usr/lib/dovecot/modules/imap mail_plugin_dir(pop3): /usr/lib/dovecot/modules/pop3 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: verbose: yes passdb: driver: sql args: /etc/dovecot/dovecot-sql.conf userdb: driver: sql args: /etc/dovecot/dovecot-sql.conf socket: type: listen client: master: path: /var/run/dovecot/auth-master mode: 384 user: dovecot group: dovecot
Expansion happens before the query, you didn't include dovecot-sql.conf so I'm not sure where it's going wrong.
you should NOT be doing select concat('/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln') as maildir
Those expansions work as:
mail_location = /mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln