[Dovecot] Variable expansion in LDA vs POP/IMAP
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 ?
-- Stephane Enten
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
On Fri, 2007-05-25 at 11:20 -0400, Jason Godsey wrote:
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. .. you should NOT be doing select concat('/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln') as maildir
Actually that does work. It's only the value returned from database that's not expanded. I think that'd be a bad idea because then any usernames or paths containing '%' characters would break.
On Sat, May 26, 2007 at 06:26:40PM +0300, Timo Sirainen wrote:
you should NOT be doing select concat('/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln') as maildir
Actually that does work. It's only the value returned from database that's not expanded. I think that'd be a bad idea because then any usernames or paths containing '%' characters would break.
I understand that the only intended expanded string is the query one, not the answer.
But then something's weird cause it's actualy expanded by deliver (in my setup they share the same dovecot-auth process hence the same SQL query).
Thanks for your help, I'll go for mail_location instead.
-- Stephane Enten
On Sun, 2007-05-27 at 15:19 +0200, Stephane Enten wrote:
On Sat, May 26, 2007 at 06:26:40PM +0300, Timo Sirainen wrote:
you should NOT be doing select concat('/mail/01/%2LMd/%2.2LMd/%LMd/mail/%Ln') as maildir
Actually that does work. It's only the value returned from database that's not expanded. I think that'd be a bad idea because then any usernames or paths containing '%' characters would break.
I understand that the only intended expanded string is the query one, not the answer.
But then something's weird cause it's actualy expanded by deliver (in my setup they share the same dovecot-auth process hence the same SQL query).
That's a bug then, because it should work identically with deliver. Fixed: http://hg.dovecot.org/dovecot-1.0/rev/2b462faf9867
Hopefully around Dovecot v2.0 I can finally get rid of this kind of special handling in deliver and just have one generic code that works the same everywhere..
participants (3)
-
Jason Godsey
-
Stephane Enten
-
Timo Sirainen