Greetings postfixers

I have a address-rewriting issue that I cannot find a golden solution for

in ldap (shortened for clairty) I have the following attributes:

uid: abc123
mail: [email protected]
alias: [email protected]
forward: [email protected]
keep: [email protected]

when a mail for the *alias* arrives, I want to tee it, using virtual_alias_maps:

[email protected] -> [email protected], [email protected]

when a mail arrives for mail OR alias, I want to check if I should
forward it (and eventual keep a local copy), using virtual_alias_map
again

[email protected] -> [email protected], [email protected]

So my initial idea was to do:

virtual_alias_maps = ldap:/path/tee.cf,ldap:/path/fwd.cf

where

tee.cf:

query_filter = (&(objectClass=MailRecipient)(alias=%s))
result_attribute = alias
result_format = %[email protected],%[email protected]

fwd.cf:

query_filter = (&(objectClass=MailRecipient)(|(mail=%s)(alias=%s)))
result_attribute = forward, keep


This works fine if incomming is for the "mail", then the fwd kicks in,
and forwards/keeps local copy

if incomming is for the alias, there is local delivery, and a tee for
the rewrite domain, but the forward check isn't done, since the first
lookup was a hit.

I cannot come up with just one ldap-query/result that returns

[email protected], [email protected],
[email protected], [email protected]

for the incomming to the alias

and

[email protected], [email protected]

for the incomming to the mail.

any suggestions on howto ???


I have one suggestion myself, and that is to add an attribute called
"rewrite" with value [email protected]
and then do

tee.cf:

query_filter = (&(objectClass=MailRecipient)(alias=%s))
result_attribute = alias,rewrite,forward,keep

but I hate the idea of maintaining (and keep sync'ed) redundant data
in the ldap, since the alias attribute is user-updateable (and ldap is
1.5M accounts)

-- 
Søren Schrøder.
Obey Gravity - It's the law !

Reply via email to