On Sat, Oct 08, 2011 at 02:40:04PM +0300, Henri Kemppainen wrote:
>
> [...]
> 
> There's something odd about virtuals; though the code I'm running is no
> longer current (5.0-BETA, to be precise).  Here's what makemap.8 says:
>     Virtual domains are kept in maps.  To create single virtual address,
>     add ``u...@example.com user'' to the virtual map.  To handle all mail
>     destined to any user at example.com, add ``@example.com user'' to the
>     virtual map.
> 
> [...]
> 
> I added some debug printfs, and they show that map_stdio_lookup is called
> with key="virtual.domain".  There is no such key, and the mail is rejected.
> Out of curiosity, I added a matching line to virtual just to see what
> happens:
>     virtual.domain          duclare
>     somebody@virtual.domain duclare
> 
> [...]
>
> I hope Gilles can tell whether this is a documentation bug or code bug.  Or
> maybe I just missed something obvious (such as a sufficiently recent
> snapshot) :-). 
> 

Hi,

This is actually a feature, not a bug ;-)

At RCPT time, smtpd needs to take a decision based on the domain itself before 
it
starts looking at user-parts and take individual decisions.

If the map has a key for the domain, then that lookup can be done efficiently 
for
backends that have indexes of some kind. If the map doesn't, then smtpd will 
have
to loop through all keys, comparing their domain parts, until one key matches.

A few months ago, when we only supported the db(3) backend, makemap had some 
code
to automagically insert a domain key if you had a virtual entry for a domain. 
But
now that we support various backends, this can't be done anymore as there is 
just
no way of doing it for the stdio(3) (plaintext) backend.

This behavior is not specific to OpenSMTPD, at least Postfix has the same need 
of
a domain key as you can observe from man virtual(5):

   """
   Without this entry, mail is rejected
       with  "relay  access  denied", or bounces with "mail loops
       back to myself".
   """


Gilles

-- 
Gilles Chehade

http://www.poolp.org/                        http://u.poolp.org/~gilles/

Reply via email to