[Mimedefang] feature request: ESMTP args

Jan Pieter Cornet johnpc at xs4all.nl
Tue Feb 8 05:18:45 EST 2005


On Mon, Feb 07, 2005 at 06:12:26PM -0800, John Nemeth wrote:
>      Would it be possible to add the capability to have ESMTP args
> passed to filter_sender() and filter_recipient(), i.e.
> 
> MAIL FROM:<addr> SIZE=N ...
> RCPT TO:<addr> ORCPT=<addr> ...
> 
> I checked the Milter API and apparently sendmail passes these in argv
> when it calls xxfi_envfrom and xxfi_envrcpt, however there is no
> mention of them in the mimedefang_filter manpage.

Mimedefang seems to ignore the extra arguments passed by milter.

However, I know you can get at the SIZE= by fetching the sendmail
${msg_size} macro. We're also doing that. You'll need a few steps
to get there:

Put this in sendmail.mc:
    dnl # pass extra macros to milter/mimedefang... without repeating
    dnl # what cfhead defined `confMILTER_MACROS_ENVFROM' to.
    define(`ORIG_confMILTER_MACROS_ENVFROM', confMILTER_MACROS_ENVFROM)
    define(`confMILTER_MACROS_ENVFROM',
		`ORIG_confMILTER_MACROS_ENVFROM, `{msg_size}'')

(there might be an easier way to add to confMILTER_MACROS_ENVFROM, but
this works too).

Add to the mimedefang command line "-a msg_size" (if you use the standard
shell script, by setting MD_EXTRA="-a msg_size"). 

Then use something like this:

    sub filter_recipient {
	#...

	read_commands_file();

	if ( defined($SendmailMacros{msg_size}) and
	     $SendmailMacros{msg_size} % 13 == 0 )
	{
	    return('REJECT', 'message size brings bad luck');
	}
	#...
    }

But then by using a slightly more useful test, probably :)

I'm not aware of how to get the ORCPT value. Could be that it's in some
sendmail macro, but I couldn't find it with a quick scan.

-- 
#!perl -wpl # mmfppfmpmmpp mmpffm <pmmppfmfpppppfmmmf at fpffmm4mmmpmfpmf.ppppmf>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig;                                # Jan-Pieter Cornet



More information about the MIMEDefang mailing list