[Dovecot] Dovecot, LDAP and something akin to Postfix' "table search order" from virtual deliver.

Pawel Sawicki pawel.sawicki at pawel-sawicki.com
Sun Mar 19 22:52:08 EET 2006


Hi.

/* The short version. */

Is there a way to mimic Postfix' "table search order" in Dovecot's LDAP 
configuration of pass_filter/user_filter?

/* Here goes the detailed description :) */

Just to quote the http://www.postfix.org/virtual.8.html:

---

TABLE SEARCH ORDER

(...)

The search order is as follows. The search stops upon  the
        first successful lookup.

(...)

        o      The user at domain.tld address, without address exten-
               sion, is looked up next.

        o      Finally, the recipient @domain is looked up.

---

Basicaly this allows to have separate users assigned addresses like 
j.doe at example.com (first account), j.smith at example.com (second account) 
and at the same time to have a "catch all" anything at example.com mailbox 
(for the administrator e.g.).

What do I need it for? To have dovecot-lda working. Why? I want Sieve :)

The test data may look as follows:

account #1:
  + mail: j.doe at example.com
  + mailAlternateAddress: j.c.doe at example.com

account #2:
  + mail: j.smith at example.com
  + mailAlternateAddress: j.t.smith at example.com

account #3 (administrator):
  + mail: bofh at example.com
  + mailAlternateAddress: @example.com (means - anything possible)

The filter I used is (more or less - for both pass_filter and user_filter):

(|(mail=%u)(mailAlternateAddress=%u)(mailAlternateAddress=@%d))

Just for testing purposes I've stripped off some irrelevant data (like 
checking if the account is active), since that made the filter about 140 
characters long ;)

The trouble is when there're both a "catch all" and a true account that 
are linked to different accounts. As an example, if I try to send mail 
to "j.doe at example.com" I receive:

dovecot: auth(default): ldap(j.doe at example.com): Multiple replies found 
for user

Which is of course true, since the filter returns "account #2" and 
"account #3".

What I'd like to get? I'd like to set the filter to:

(|(mail=%u)(mailAlternateAddress=%u))

Where "%u" is expanded to "j.doe at example.com" during the first run

Then, if dovecot can't find any user that would match this literaly it 
should retry the search operation, but now with "@example.com" as the "%u".

I've tried to fiddle with the filter itself, but I see any reasonable 
way of doing it. I don't even know if it is possible at all.

Could anyone give me a hint? Or maybe it's already on someone's whish list?

Some final info.

* I've followed the examples on dovecot.org website:

http://wiki.dovecot.org/LDA#head-dacb9b9a1f19c3ea86bb6f8caa3d64e3ddad9ef8

* Here's the dovecot's master.conf entry:

dovecot unix - n n - - pipe flags=DRhu user=mail:mail 
argv=/usr/libexec/dovecot/deliver -d ${recipient}

Best regards!
Pawel Sawicki


More information about the dovecot mailing list