[Pymilter] [PATCH] Patch to add support for new Milter callbacks

Frédéric Jolliton python-milter at frederic.jolliton.com
Sun Jul 15 14:16:11 EDT 2007


Hi,

I made a patch to add support for the recent callbacks added in Sendmail
8.14.0 to milter. It is NOT backward compatible with older milter
library versions (if you apply the patch, it will not compile for
sendmail/milter<=8.13) but it shouldn't be too hard to conditionnaly
compile new features otherwise. I've not found support planned for them,
but I hope I've not duplicated some works.

This add support for `data', `unknown' and `negotiate' callbacks,
including constants definitions for the new return values (SKIP, NOREPLY
and ALL_OPTS) and also constants definitions needed by the negotiate
callback.

However, this patch doesn't implements all the new features, such as
chgfrom, addrcpt_par or macros, because I don't need them at the moment.

Since negotiate is called first, it is now the negotiatecallback in the
Python module which create the filter instance (instead of
connectcallback previously.)

An example: to request that the connect callback shouldn't be called, we
can use something like:

class MyFilter( NullFilter ) :
  ..
  def negotiate(self, inputs, outputs):
    if inputs[1] & Milter.P_NOCONNECT :
      # Ok, milter can be configured to not call connect callback
      outputs[1] != Milter.P_NOCONNECT
    return CONTINUE
  ..

The inputs parameters is a tuple with the (f0,f1,f2,f3) values and
outputs parameters is a list which represent the values pointed by
(pf0,pf1,pf2,pf3) and must be destructively modified, accordingly
to:

    http://www.mirbsd.org/cman/docs/milter/xxfi_negotiate.html

Tested under Linux 2.6/x86-32, Python 2.5, Sendmail 8.14.1, gcc 4.1.2.

-- 
Frédéric Jolliton

-------------- next part --------------
A non-text attachment was scrubbed...
Name: milter-api-814.patch
Type: text/x-patch
Size: 11177 bytes
Desc: Patch to support new callbacks introduced in Sendmail 8.14
URL: <http://gathman.org/pipermail/pymilter/attachments/20070715/df5c52a9/attachment.bin>


More information about the Pymilter mailing list