[Mimedefang] Accessing the source/destination port #'s at filter_relay

Dave O'Neill dmo at roaringpenguin.com
Tue May 4 14:43:36 EDT 2010

On Tue, May 04, 2010 at 11:25:16AM -0700, - wrote:
> The milter interface docs tells us that the needed variables are 
> available at the filter_helo() stage (if such is enabled).

Sure, but the way MIMEDefang passes those macros down to the Perl code 
is by writing lines like:
         =client_port 23456
         =daemon_port 25
to the COMMANDS file.

The problem and we don't have a COMMANDS file until after MAIL FROM, 
because we wait until Sendmail gives us a queue ID so that we can use 
that ID in the directory name.

One option we were kicking around is using a different identifier for 
the directory name.  We're already generating a unique per-message 
identifier (gen_mx_id(), which gives us $MIMEDefangID via an 'i' line in 
COMMANDS) so all that would need to be done is:
         - generate that identifier earlier
         - create /var/spool/MIMEDefang/mdefang-XXXXXXXX using the mxid 
           value instead of the queue ID value
         - create the COMMANDS file earlier

Possible problems:
         - additional overhead created by generating these directories 
           earlier on (not sure how significant this would be)
         - confusion or breakage of external scripts that relied on 
           mdefang- directories containing the Sendmail queue ID in their 
           name.  This could be mitigated by auto-generating symlinks 
           once we do have a queue ID

         - filter_helo() can stop being a second-class citizen, as it 
           would have a COMMANDS file


Dave O'Neill <dmo at roaringpenguin.com>    Roaring Penguin Software Inc.
+1 (613) 231-6599                        http://www.roaringpenguin.com/
For CanIt technical support, please mail: support at roaringpenguin.com

More information about the MIMEDefang mailing list