Dear OpenSMTPD Developers! I think there is a little "bug/feature" with respect to handling "mask-source" parameter with "listen on" directive in smtpd.conf. The behavior makes perfect sense from the perspective of documentation. Unfortunately it is not uniform from the perspective of the client.
Basically, if the message is handled through smtp_accept() in smtp.c then everything works as expected. If the message is enqueued from localhost (for example through sendmail), the message is handled by smtp_enqueue() in smtp.c, and at this point the behavior starts to get non-uniform. The local listener is created upon the first invocation of smtp_enqeue(), and the listener->flags are set to 0. Because there is no way to specify the flags for the "local" listener, the behavior is not intuative if the client specified "mask-source" option for the "listen on" loopback interface directive. I suspect that if mask-source is on for lo0, the client would probably want the same behavior for the messages submited through the local queue. I think this situation can be handled in one of three ways. A new special directive can be created to influence the creation of this listener, however, this feels a little messy. Another approach, is to create support for "listen on local" or similar, which makes everything a bit more uniform. And the last approach could mimick what "listen on lo0" or any other loopback device does and apply the same policy to the "local" listener. For example, this can be implemented by searching through env->sc_listeners for loopback listeners, and if any of them have F_MASK_SOURCE flag, apply it to the local listener as well. What are your thoughts? I am more than happy to provide the patch for any of the above described scenarios assuming they would provide an adequate solution. Thank you for your time! Regards, --peter