Project mailfromd

mailfromd

8.14  —  2022-08-13
* Initialization of implicitly declared automatic variables

Implicitly declared automatic variables are initialized to null
values, just like global ones.  This means, in particular that
the following code is now valid:

  func foo()
  do
    if bar()
       set a "ok"
    fi
    echo a
  done

Depending on the return value of bar(), this function will print
either "ok" or an empty string.  In previous versions, it would
produce unspecified results.

* Buffered I/O

The I/O operations can be buffered.  Use of fully buffered streams
can dramatically improve performance, especially for `getline' and
`getdelim' calls.

The global variables `io_buffering' and `io_buffer_size' define
buffering mode and associated buffer size for file descriptors
returned by the subsequent calls to `open' or `spawn'.  Buffering mode
of an already open file descriptor can be changed using the `setbuf'
function.

The `io_buffering' variable defines the buffering mode.  By
default it is 0 (BUFFER_NONE), which disables buffering for
backward compatibility with the previous versions.  Another
possible values are: 1 (BUFFER_FULL) and 2 (BUFFER_LINE)

When set to BUFFER_FULL, all I/O operations become fully buffered.
The buffer size is defined by the `io_buffer_size' global variable.

BUFFER_LINE is similar to BUFFER_FILE when used for input.  When used
for the output, the data are accumulated in buffer
and actually sent to the underlying transport stream when the newline
character is seen.  The `io_buffer_size' global variable sets the
initial value for the buffer size in this mode.  The actual size can
grow as needed during the I/O.

The default value for `io_buffer_size' is the size of the system page.

The symbolic constants BUFFER_NONE, BUFFER_FULL and BUFFER_LINE are
defined in the 'status.mf' module.  E.g.:

  require status

  begin
  do
    io_buffering = BUFFER_FULL
  done

Use the `setbuf' function to change the buffering mode and/or buffer
size for an already opened stream, e.g.:

  setbuf(fd, BUFFER_FULL, 4096)

* Changes in read and write functions

The 'read' function tries to read as much data (up to the requested
amount) as possible.  It will return success if it succeeded to read
less bytes than requested (in previous versions it would incorrectly
signal the e_io exception in this case).  Use the length() function
to determine actual number of bytes read.  The 'read' functions signals
e_eof if it read 0 bytes and e_io if an error occurred.

The 'write' function tries to write as much data (up to the requested
amount) as possible.  It will signal e_io in case of error and e_eof
if 0 bytes were written.

* dkim_sign and Sendmail

Sendmail silently modifies certain headers before sending the
message in the SMTP transaction.  It has been reported that on certain
occasions this invalidates DKIM signatures created by dkim_sign().
To prevent this from happening, dkim_sign() now mimics the Sendmail
behavior and reformats those headers before signing the message.  The
headers affected are: Apparently-To, Bcc, Cc,
Disposition-Notification-To, Errors-To, From, Reply-To, Resent-Bcc,
Resent-Cc, Resent-From, Resent-Reply-To, Resent-Sender, Resent-To,
Sender, To.

This behavior is controlled by the global variable
dkim_sendmail_commaize.  Set it to 0 to disable it.

* Support for rsa-sha1 in DKIM

Both dkim_sign and dkim_verify support rsa-sha1 for compatibility with
older software.  Upon return from dkim_verify the name of the algorithm
used to sign the message is stored in the global variable
dkim_signing_algorithm.  The dkim_sign function takes additional
optional argument that specifies the algorithm to use.  Its
declaration is now:

  void dkim_sign(string d, string s, string keyfile
                 [, string ch, string cb, string headers, string algo ])

* New DKIM explanation code: DKIM_EXPL_BAD_KEY_TYPE

This code is reported by `dkim_verify' if the `k=' tag of the public
DKIM key contains a value other than "rsa".

* Support for CNAME chains

CNAME chains are formed by DNS CNAME records pointing to another
CNAME.  Using CNAME chains in DNS is not considered a good practice and
prior versions of mailfromd would refuse to resolve a CNAME pointing to
CNAME.  However, this interacted badly with certain DNS servers that
publish otherwise valid RRs pointed to by 2 or 3 element CNAME chains.
To cope with such server, mailfromd now allows for CNAME chains of
length 2 by default.  This can further be configured using the
"max-cname-chain" statement in the "resolver" section of mailfromd
configuration file (see below).

* The "resolver" configuration statement

This new configuration statement configures certain aspects of the
internal DNS resolver.  The syntax is as follows:

  resolver {
    config FILENAME;
    max-cname-chain NUM;
  }

The "config" statements defines the name of the resolver configuration
file to use instead of the default /etc/resolv.conf.

The "max-cname-chain" statement defines the maximum length of a CNAME
chain that will be followed.  The default is 2.

* Bugfixes

** Fixed sorting in dns_query()

** Fixed a bug in message I/O functions

If compiled with mailutils versions newer than 3.13, this bug would
provoke infinite recursion in message_to_stream or its derived
functions.

** Fixed a bug in dkim_sign routine

The bug would cause coredumps on 32-bit architecture.

** Avoid dereferencing undefined optional arguments in built-ins

** Fixed return value of hasmx function

** Fixed header handling in send_text, create_dsn and send_dsn built-ins

** Fixed compilation with flex >= 2.6.1

** Remove unused configuration variables
	  

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.