[Mimedefang] Grandparent of filter process is fairly unique? [passing extra macros]

Andrzej Adam Filip anfi at onet.eu
Sat Dec 27 16:18:45 EST 2008


"Kelly Jones" <kelly.terry.jones at gmail.com> wrote:

> On 12/26/08, Andrzej Adam Filip <anfi at onet.eu> wrote:
>> "Kelly Jones" <kelly.terry.jones at gmail.com> wrote:
>>
>>> [...]
>>> Does mimedefang-filter get the remote port number? Could I tweak the
>>> code to pass it?
>>> [...]
>>
>> You can configure sendmail to pass extra variables to milter (mimedefang).
>>
>> ${client_addr}
>> ${client_port}
>> ${daemon_addr}
>> ${daemon_port}
>
> That sounds great! What are the sendmail.mc macros to do this?
>
> The client_addr/client_port should be fairly unique, at least for a
> period of time, excluding intentionally misconfigured clients.

http://www.sendmail.org/m4/tweaking_config.html

e.g.
define(`confMILTER_MACROS_CONNECT',
  `j, _, {daemon_name}, {if_name}, {if_addr}, {client_addr}, {client_port}')

I have added {client_addr} and {client_port} to default settings.

Remember that mimedefang can use set different processes to handle
single SMTP session call-backs (connect,helo,mail from, rcpt to, ...).

> Can sendmail pass the pid of the sendmail fork that's handling a given
> request? I could probably get that from the client_addr/client_port,
> but that seems inefficient.

Try passing $p. The wording in The Bat Book makes me suggest you to
check *carefully* if $p macro is set to proper value in all call-backs. 

-- 
[pl>en: Andrew] Andrzej Adam Filip : anfi at onet.eu : anfi at xl.wp.pl
Let the machine do the dirty work.
  -- "Elements of Programming Style", Kernighan and Ritchie



More information about the MIMEDefang mailing list