Project mailfromd

mailfromd

9.0  —  2024-01-05
* Compatibility .mf suffix not supported any more

* Begin and end handlers must be defined using prog keyword

* Module and include search paths

Since version 8.15, if a module was not found in module search path,
the search was retried using include search path.  This is no longer
the case: the two paths serve different purposes and don't interact
in any way.  MFL modules are searched in module search path only.

* Use of Sendmail macros in run mode

Sendmail macros can be defined in run mode by placing assignments
macro=value before the script file name, e.g.:

  mailfromd --run i=123 client_addr=::1 test.mfl foo bar baz

This example defines Sendmail macro "i" to "123" and "client_addr" to
"::1".  The words "foo", "bar", and "baz" will be passed to the
main function as positional parameters.

* Full IPv6 support

This causes changes in the following MFL functions (see also "New functions",
below):

** dns_query

 number dns_query (number TYPE, string DOMAIN; number SORT, number RESOLVE)

The semantics and possible values of the RESOLVE argument have
changed.  It used to be a boolean value.  Now its allowed values (as
defined in status.mfl module) are:

     'RESOLVE_NONE'
          Don't resolve hostnames to IP addresses.  This is the default.

     'RESOLVE_DFL'
          Resolve hostnames to IP addresses according to the address
          family of the SMTP session.  That is, use 'A' records if the
          client connected using the INET family (i.e.  connected to the
          IPv4 address), and use 'AAAA' records if the client connected
          to the IPv6 address.

     'RESOLVE_IP4'
          Resolve hostnames to IPv4 addresses ('A' records).

     'RESOLVE_IP6'
          Resolve hostnames to IPv6 addresses ('AAAA' records).

Values of these constants has been selected so that any existing
code using 0/1 as the value of this argument will work without
changes.

** primitive_resolve and resolve functions

 string primitive_resolve (string HOST; string DOMAIN, number FAMILY)
 string resolve (string HOST; string DOMAIN, number FAMILY)

The use of DOMAIN argument is deprecated.

By default the function selects the type of RR set to search for
using the address family of the SMTP connection: A is used for INET
(IPv4 addresses) and AAAA is used for INET6 (IPv6 addresses).

New argument FAMILY can be used to request particular RR type.  Its
possible values are:

     'RESOLVE_DFL'
          Look for 'A' or 'AAAA', depending on the connection type.
          This is the default.

     'RESOLVE_IP4'
          Resolve to IPv4 addresses ('A' records).

     'RESOLVE_IP6'
          Resolve to IPv6 addresses ('AAAA' records).

* New functions

** string is_ipstr(string S)

Returns 1 if S is a string representation of an IP address (IPv4 or
IPv6).

** string is_ip4str(string S)

Returns 1 if S is a string representation of an IPv4 address.

** string is_ip6str(string S)

Returns 1 if S is a string representation of an IPv6 address.

** string reverse_ipstr(string IP)

Returns a reversed representation of the IP address, suitable for
use in DNS labels.

** string tr(string SUBJ, string SET1, string SET2)

Transliterates characters in SUBJ by replacing all occurrences of the
characters found in SET1 with the positionally corresponding characters
in SET2.  Character ranges ('a-z') are allowed in both sets.  A character
range in SET1 translates to a corresponding character from the range in
SET2, e.g. tr(x, 'a-z', 'A-Z') translates string x to uppercase.

Character classes ([a-z], [[:alpha:]], etc) are allowed in SET1 and
translate to the corresponding single character from SET2, e.g.
tr(x, '[[:digit:]]', '_') replaces all decimal digits in string x with
underscores.

** string dc(string SUBJ, string SET)

Deletes from SUBJ characters that appear in SET.  The syntax of SET is as
described for SET1 above.

** string sq(string SUBJ, string SET)

"Squeeze repeats".  Replaces each sequence of a repeated character
that is listed in SET, with a single occurrence of that character.

* Changes in match_cidr function.

The match_cidr function is re-implemented as a built-in.

The module match_cidr.mfl is deprecated.

* Deprecated MFL modules

The following MFL modules are deprecated.  They are retained for
backward compatibility.  Existing code using any of these will compile
and work as in previous releases, except that a warning will be
printed to draw your attention to the fact.  You are advised to remove
any uses of these modules, as they will be removed in future versions:

** match_cidr.mfl

This module is not needed any more.

** is_ip.mfl

This module defines function is_ip() which is superseded by is_ipstr()
built-in (see above).

** revip.mfl

This module defines function revip() which is superseded by
reverse_ipstr() built-in.
	  

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.