[Dovecot] Dovecot-lda and multiple records after filter.

Басов Евгений worklord at yandex.ru
Wed Apr 13 22:31:09 EEST 2011


Hello.

Some records in my LDAP base have same values in mail field:

# extended LDIF
#
# LDAPv3
# base <ou=Mail, dc=ph, dc=local> with scope subtree
# filter:
(&(mail=someuser at p.ru)(|(AccountStatus=active)(accountStatus=shared)))
# requesting: mailMessageStore
#
dn: cn=lala,ou=Mail,dc=ph,dc=local
mailMessageStore: /var/mail/someuser/Maildir/

# Eset, Mail, ph.local
dn: cn=Eset,ou=Mail,dc=ph,dc=local

# admins, Mail, ph.local
dn: cn=admins,ou=Mail,dc=ph,dc=local

# search result
search: 2
result: 0 Success

# numResponses: 4
# numEntries: 3

Postfix with virtual_transport = virtual works fine: letter to "dn:
cn=lala,ou=Mail,dc=ph,dc=local" stolen in mailMessageStore path and one
for mailing list "dn: cn=admins,ou=Mail,dc=ph,dc=local"/"dn:
cn=admins,ou=Mail,dc=ph,dc=local" are send to "dn:
cn=lala,ou=Mail,dc=ph,dc=local".

One of filter Postfix uses:
(&(|(mail=%s)(mailAlternateAddress=%s))(|(AccountStatus=active)(accountStatus=shared)))

So, set on dovecot-lda.

main.cf:
dovecot_destination_recipient_limit = 1
virtual_transport = dovecot
#virtual_transport = virtual

master.cf:
dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:mail argv=/usr/libexec/dovecot/deliver -f
${sender} -d ${recipient}

one place in dovecot-ldap.ext.conf:
user_filter =
(&(objectClass=qmailUser)(|(AccountStatus=active)(accountStatus=shared))(|(mail=%u)(mailAlternateAddress=%u)))
pass_filter =
(&(objectClass=qmailUser)(|(AccountStatus=active)(accountStatus=shared))(|(mail=%u)(mailAlternateAddress=%u)))
user_attrs = mailMessageStore=home
pass_attrs = uid=user,userPassword=password

Send test letter:
mutt -s "test $(date +%d/%m/%Y:%H.%M)" -- someuser at p.ru < /dev/null

and get in log:
dovecot: lda: Debug: Module loaded: /usr/lib64/dovecot/lib90_sieve_plugin.so
dovecot: auth: Debug: master in: USER#0111#011someuser at p.ru#011service=lda
dovecot: auth: Debug: ldap(someuser at p.ru): user search: base=ou=Mail,
dc=ph, dc=local scope=subtree
filter=(&(objectClass=qmailUser)(|(AccountStatus=active)(accountStatus=shared))(|(mail=someuser at p.ru)(mailAlternateAddress=someuser at p.ru)))
fields=mailMessageStore
dovecot: auth: Debug: ldap(someuser at p.ru): result:
mailMessageStore(home)=/var/mail/someuser/Maildir/
dovecot: auth: Error: ldap(someuser at p.ru): user_filter matched multiple
objects, aborting
dovecot: auth: Debug: master out: FAIL#0111
dovecot: lda: Error: user someuser at p.ru: Auth USER lookup failed
dovecot: lda: Debug: auth input:
dovecot: lda: Fatal: Internal error occurred. Refer to server log for
more information.
postfix/pipe[3259]: 89001846: to=<someuser at p.ru>, relay=dovecot,
delay=0.15, delays=0.07/0.01/0/0.07, dsn=4.3.0, status=deferred
(temporary failure)

As we can see mailMessageStore gets right value and… it's all.

How can I get Postfix-like behavior from dovecot-lda?

With best regards,
Basov Evgeny.



More information about the dovecot mailing list