Project mailfromd

mailfromd

8.15  —  2022-12-11
* Default MFL source file suffix

The default suffix for MFL files is changed to '.mfl'.  In particular,
the master script file is now "mailfromd.mfl".  This change is
intended to avoid confusion with Metafont files, which have suffix
'.mf'.

As of this version, the new suffix is recommended, but not obligatory:
the legacy '.mf' suffix is still supported.  If a file 'X.mfl' is not
found, mailfromd will look for 'X.mf'.

* MFL module search path

MFL modules loaded using the "require" or "import" statements are
looked up in module search path.  Previously, they were searched for
in include search path, which created confusion, since include
search path is intended for use by preprocessor.  To maintain backward
compatibility, if mailfromd is unable to find a module in module
search path, it will retry the search using include path.  This
behavior will be maintained during a transitional period (a couple of
releases), after which searches in include search path will be
discontinued.

* Preprocessor configuration

Use of preprocessor is configured by the following statement in the
main configuration file:

  preprocessor {
    # Enable preprocessor.
    enable yes;
    # Preprocessor command line stub.
    command "m4 -s";
    # Pass current include path to the preprocessor via -I options.
    pass-includes false;
    # Pass to the preprocessor the feature definitions via -D options
    # as well as any -D/-U options from the command line.
    pass-defines true;
    # Name of the preprocessor setup file.  Unless absolute, it is
    # looked up in the include path.
    setup-file "pp-setup";
  }

If preprocessor.pass-includes is true, the preprocessor.command
setting is augmented by zero or more -I options, thereby supplying it
the mailfromd include path.

Furthermore, if preprocessor.pass-defines is set, zero or more
-D options defining optional features are passed to it (e.g.
-DWITH_DKIM) as well as any -D and -U options from the mailfromd
command line.

Unless the value of preprocessor.setup-file begins with a slash,
the file with this name is looked up in the current include search
path.  If found, its absolute name is passed to the preprocessor as
first argument.

If the value begins with a slash, it is passed to the preprocessor
as is.

* New MFL operator: $@

The $@ operator can be used as the last argument in a call to
variadic function from another variadic function.  It passes
all variable arguments supplied to the calling function on to
the function being called.  E.g.:

    func x(...)
    do
      # do something
    done

    func y(string x, ...)
    do
      x($@)
    done

In this example, if "y" is called as y("text", 1, 2, 3) it will call
"x" as x(1, 2, 3).

This operator can also be used with a numeric argument: $@(N).  In
this case, it will remove first N elements from the argument list and
push remaining ones on stack.  This is similar to the 'shift'
operator in other programming languages, e.g.:

    x($@(2))

* Data types in variadic function declaration

The ellipsis in a variadic function declaration can be preceded by
the data type, e.g.:

  func sum (number ...) returns number

For compatibility with previous versions, if the type is omitted,
string is assumed.

* The void() type cast

The void() type cast can be used around a function call to indicate
that its return value is ignored deliberately.

* mfmod: dynamically loaded modules

This new type of mailfromd modules uses dynamically loaded libraries
to extend the program functionality without having to modify its code.
For a detailed discussion see the manual, section 4.22, "Dynamically
Loaded Modules".

Three mfmods exist at the time of this writing:

  - https://www.gnu.org.ua/software/mfmod_ldap/
    LDAP searches.

  - https://www.gnu.org.ua/software/mfmod_openmetrics
    Open metrics support.

  - https://www.gnu.org.ua/software/mfmod_prce/
    Support for Perl-comparible regular expressions.

* Syntax of special handler definitions

Special handlers ("begin" and "end", in particular) are now defined using
the standard "prog" keyword (similar to milter state handlers):

  prog begin
  do
    ...
  done

  prog end
  do
    ...
  done

Old syntax is supported for backward compatibility, but causes a
deprecation warning.  Application writers are advised to update their
code.

* New special handlers: startup and shutdown

These two handlers provide global initialization and cleanup routines.
The "startup" handler is run by the master mailfromd process as part
of the startup sequence, before the program starts to serve any milter
requests.  The "shutdown" handler is run when mailfromd is about to
terminate.

Notice an important differences between "startup"/"shutdown" and
"begin"/"end" special handlers.  The latter are session specific: they
are run at the start and end of a milter session.  The former are
global: they are run at the program startup and shutdown.

The "startup" handler is normally used by mfmod interface modules to
load the corresponding shared library.

* Use of STARTTLS in callout

If TLS is supported by libmailutils, the SMTP callout code will use
STARTTLS when offered by the remote server.  This is controlled by the
smtp-starttls configuration statement.  Its possible values are:

  never
    Never use STARTTLS.

  always
    Always use STARTTLS if offered by the server.

  ondemand
    Use STARTTLS only if MAIL FROM: command failed with the code
    530 (Authorization required).

The default is "ondemand".

* Qualified DBM file names in database configuration

Argument to database.file statement can be prefixed with "database
scheme" to select alternative DBM implementation.  For example:

  database rate {
     file "gdbm://rate.db";
  }

See the manual, section 7.11 "Database Configuration" for details.

* New command line option: --echo

The --echo option allows you to control where the output of the "echo"
statement goes in "run" and "test" modes.  When used without argument
it directs the output to the standard output stream.  If an argument
is supplied (as in: --echo=FILE), the output goes to the named file.
The file will be created if it doesn't exist.  Notice, that in the
latter case, the use of '=' is compulsory (--echo FILE won't work).

* Deprecated configuration statements removed

Deprecated configuration statements `lock-retry-count' and
`lock-retry-timeout' were removed in this version.  Use
the `locking' statement instead, e.g. instead of

  lock-retry-count 10;
  lock-retry-timeout 1;

write

  locking {
    retry-count 10;
    retry-sleep 1;
  }

* Removed support for obsolete features: legacy GeoIP and DSPAM
	  

Mailfromd is a general-purpose mail filtering daemon for Sendmail, Postfix and MeTA1. It is able to filter both incoming and outgoing messages using criteria of arbitrary complexity, supplied by the administrator in the form of a script file. The daemon interfaces with the MTA using Milter or PMilter protocols.