Russell Yanofsky: > The attached patch fixes the problem for me. It changes the relevant > smtpd_resolve_addr() call in smtpd_check.c to use the message sender.
One complication is that the smtpd_resolve_addr cache is not only used for validating recipients, but also for validating senders. See check_sender_rcpt_maps(), which is used by reject_unlisted_sender and smtpd_reject_unlisted_sender. It don't know if your patch also makes that case work better, but I suppose it is sufficient if it does not make things worse. Always indexing the "resolve address" cache by sender+recipient makes the cache less effective for everyone, and I expect that almost no-one uses sender-dependent routing. So I may prefer to make that part dependent on whether sender-dependent routing is actually enabled. I'm not fond of code that mallocs/copies/frees strings by hand, because it is very easy to make a mistake. I think that you're forgetting to free(sender) in resolve_pagein(), but such mistakes are easily avoided by using higher-level primitives. Wietse