[Mimedefang] Future development

Anne Bennett anne at encs.concordia.ca
Mon Nov 23 12:41:00 EST 2020


> The Perl code is atrocious.

Give yourself a break.  ;-)

> mimedefang.pl is over 7500 lines of
> Perl in one ugly file with a ton of global variables.  It needs a major
> overhaul.

For me as a filter writer, problems have been:

  - Initially (years ago), it was a bit hard to keep track of the bits
    and pieces, because mimedefang.pl calls my filter file, and my
    filter file calls various utilities provided by mimedefang.pl.
    Any code re-org that would make it easier to untangle this would
    help, even something as simple as putting the user-filter-called
    facilities into their own Perl module.

  - I like to run with Perl taint checks on, but mimedefang.pl
    doesn't cooperate well with that.

  - Picking up needed information (i.e., from the envelope and
    message, and QID) seems to be different in each filter_*
    subroutine.  I don't know how this would affect performance,
    but if there were a hash containing all available header,
    envelope, message status so far (e.g., did we mark as to
    be rejected?), and QID information, and maybe even headers
    in concatenated and decoded form, that would make writing
    filter_* subroutines easier.

> I would start by writing a MD::Filter base class
> and storing state in the MD::Filter object.  Callbacks could be implemented
> as methods and users could subclass MD::Filter to implement their behaviour.

As another poster mentioned, that would indeed require more
advanced Perl chops from the end user (postmaster), though
well-chosen examples might go a long way toward alleviating
that requirement.

> The actual filter file would be a very simple thing that simply
> instantiates a (subclass of) MD::Filter and calls $filter->run() to
> run the main mimedefang.pl loop.

Well, there's still potentially a fair amount of homegrown code that
people can add.  I'm assuming that this would somehow fit into "users
could subclass MD::Filter to implement their behaviour".

It is definitely the case that backwards compatibility would be an
issue for those of us with thousands of lines of locally written code.



Anne.
-- 
Ms. Anne Bennett, Senior Sysadmin, ENCS, Concordia University, Montreal H3G 1M8
anne at encs.concordia.ca                                    +1 514 848-2424 x2285



More information about the MIMEDefang mailing list