aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-11-02 15:44:27 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-11-02 15:44:27 +0200
commit38e58d3662ac6c2e53e9ec8b85934e0e23a199c0 (patch)
tree13eb93e3ff14c94ccdcaa13a0a85ed883ece438a
parentf7ea305fee69c0814a075d01b2b92a153916f093 (diff)
downloadmailfromd-38e58d3662ac6c2e53e9ec8b85934e0e23a199c0.tar.gz
mailfromd-38e58d3662ac6c2e53e9ec8b85934e0e23a199c0.tar.bz2
Follow Mailutils commit dc62b399
-rw-r--r--NEWS26
-rw-r--r--doc/Makefile.am6
-rw-r--r--doc/calloutd.texi247
-rw-r--r--doc/functions.texi92
-rw-r--r--doc/mailfromd.texi75
-rw-r--r--doc/upgrade.texi45
-rw-r--r--etc/Makefile.am2
-rw-r--r--lib/mfgetopt.c4
-rw-r--r--mflib/Makefile.am2
-rw-r--r--src/main.c175
-rw-r--r--tests/atlocal.in2
-rw-r--r--tests/shellmagic.at2
12 files changed, 584 insertions, 94 deletions
diff --git a/NEWS b/NEWS
index c96c0307..a875321b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,2 +1,2 @@
-Mailfromd NEWS -- history of user-visible changes. 2016-10-30
+Mailfromd NEWS -- history of user-visible changes. 2016-11-02
Copyright (C) 2005-2016 Sergey Poznyakoff
@@ -9,4 +9,3 @@ Version 7.99.97, (Git)
-This version is highly experimental and lacks documentation.
-Use `git log' for a detailed description of changes.
+This version is a major rewrite. Main changes:
@@ -14,5 +13,15 @@ Use `git log' for a detailed description of changes.
-* New utility mfdbtool
* New daemon calloutd
+The calloutd utility is a stand-alone callout daemon. It allows you
+to run sender address verification from a separate server. See the
+section 'Milter and Callout servers' below, for a detailed explanation.
+
+* New utility mfdbtool
+
+In previous versions database management tasks were performed by
+mailfromd itself when it was called with appropriate options (--list,
+--delete, --expire). Now these options are gone, and all database
+management tasks are carried out by a stand alone utility mfdbtool.
+
* Changes to mailfromd configuration
@@ -67,3 +76,3 @@ must be invoked with some additional option passed to mailfromd (say
#!/bin/sh
- exec /usr/sbin/mailfromd --no-user-conf --run $0 $@
+ exec /usr/sbin/mailfromd --no-config --run $0 $@
!#
@@ -505,6 +514,5 @@ for all milter servers declared in the configuration.
-Alternatively, you may use a remote callout server, i.e. a separate
-instance of mailfromd, dedicated for that purpose. In that case,
-the address of a callout server is declared using the `callout-url'
-statement:
+Alternatively, you may use a remote callout server run by a separate
+daemon 'calloutd'. In that case, the URL of a callout server is
+declared using the `callout-url' statement:
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9a9b6116..d97a2141 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -49,3 +49,3 @@ check-mailfromd-options:
@$(CHECK_DOCS) "mailfromd options" \
- '/argp_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg;/argp_option srv_options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
+ '/mu_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg;/mu_option srv_options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
's/@opindex *\([^@,]*\), --.*mailfromd option.*/\1/p' \
@@ -57,3 +57,3 @@ check-calloutd-options:
@$(CHECK_DOCS) "calloutd options" \
- '/argp_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg;/argp_option srv_options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
+ '/mu_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg;/mu_option srv_options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
's/@opindex *\([^@,]*\), --.*calloutd option.*/\1/p' \
@@ -65,3 +65,3 @@ check-mfdbtool-options:
@$(CHECK_DOCS) "mfdbtool options" \
- '/argp_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
+ '/mu_option options\[\] = /,/^}/s/[ \t]*{ *"\([^,"]*\)".*/\1/pg' \
's/@opindex *\([^@,]*\), --.*mfdbtool option.*/\1/p' \
diff --git a/doc/calloutd.texi b/doc/calloutd.texi
index 67597fe4..9e1c9ce2 100644
--- a/doc/calloutd.texi
+++ b/doc/calloutd.texi
@@ -7,5 +7,5 @@
@command{mailfromd} (@pxref{callout server}). However, it is also
-possible to set up callout server on a separate machine. You can
-choose to do so, for instance, in order to reduce the load on the
-server running @command{mailfromd}.
+possible to set up a dedicated callout server on a separate machine.
+You can choose to do so, for instance, in order to reduce the load on
+the server running @command{mailfromd}.
@@ -28,2 +28,161 @@ server running @command{mailfromd}.
+@subheading Server configuration modifiers
+@table @option
+@opsummary{foreground, calloutd}
+@item --foreground
+Stay in foreground. When given this option, @command{calloutd} will
+not disconnect itself from the controlling terminal and will run in
+the foreground.
+
+@opsummary{group, calloutd}
+@item -g @var{name}
+@itemx --group=@var{name}
+
+Retain the group @var{name} when switching to user
+privileges. @xref{Starting and Stopping}.
+
+@opsummary{pidfile, calloutd}
+@item --pidfile=@var{file}
+Set pidfile name. Overrides the @code{pidfile} configuration
+statement, which you are advised to use instead (@pxref{conf-base, pidfile}).
+
+@opsummary{source-ip, calloutd}
+@item -S @var{ip}
+@itemx --source-ip=@var{ip}
+Set source address for @acronym{TCP} connections. Overrides the
+@samp{source-ip} configuration statement, which you are advised to use
+instead (@pxref{conf-base, source-ip}).
+
+@opsummary{single-process, calloutd}
+@item --single-process
+Do not fork sub-processes to serve requests. This option is meant to
+assist in debugging @command{calloutd}. Don't use it for anything
+else but for debugging, as it terribly degrades performance!
+
+@opsummary{state-directory, calloutd}
+@item --state-directory=@var{dir}
+Set new program state directory. @xref{statedir, Local state directory}, for
+the description of this directory and its purposes.
+
+@opsummary{user, calloutd}
+@item -u @var{name}
+@itemx --user @var{name}
+Switch to this user's privileges after startup. Overrides the @code{user}
+configuration file statement, which you are advised to use instead
+(@pxref{conf-priv, user}). Default user is
+@samp{@value{DEFAULT_USER}}.
+@end table
+
+@subheading Logging and debugging options
+@table @option
+@opsummary{debug, calloutd}
+@item -d @var{string}
+@itemx --debug=@var{string}
+Set debugging level. @xref{Logging and Debugging}.
+
+@opsummary{log-facility, calloutd}
+@item --log-facility=@var{facility}
+Output logs to syslog @var{facility}.
+
+@opsummary{log-tag, calloutd}
+@item --log-tag=@var{string}
+Tag syslog entries with the given @var{string}, instead of the program name.
+
+@opsummary{logger, calloutd}
+@item --logger=@var{mech}
+Set logger mechanism (@var{mech} is one of @samp{stderr},
+@samp{syslog}, @samp{syslog:async}). @xref{Logging and Debugging}.
+
+@opsummary{syslog, calloutd}
+@item --syslog
+Selects default syslog mechanism for diagnostic output.
+
+@opsummary{stderr, calloutd}
+@item --stderr
+Directs all logging to standard output. Similar to @option{--logger=stderr}.
+
+@opsummary{source-ip, calloutd}
+@item -S @var{ip}
+@itemx --source-ip=@var{ip}
+Set source address for @acronym{TCP} connections. Overrides the
+@samp{source-ip} configuration statement, which you are advised to use
+instead (@pxref{conf-base, source-ip}).
+
+@opsummary{debug-level, calloutd}
+@item --debug-level=@var{level}
+Set Mailutils debugging level. See
+@uref{http://mailutils.org/wiki/Debug_level}, for a detailed
+discussion of @var{level} argument.
+
+@opsummary{source-info, calloutd}
+@item --source-info
+@itemx --no-source-info
+Include @sc{c} source information in debugging messages. This is
+similar to setting @code{line-info yes} in the @code{debug}
+configuration block (@FIXME-pxref{debug configuration}).
+
+The @option{--no-source-info} can be used to cancel the effect of the
+@code{line-info yes} configuration statement.
+
+You do not need this option, unless you are developing or debugging
+@command{calloutd}.
+
+@opsummary{transcript, calloutd}
+@item -X
+@itemx --transcript
+@itemx --no-transcript
+Enable or disable transcript of the @acronym{SMTP} sessions to the log
+channel. @xref{Logging and Debugging}.
+@end table
+
+@subheading Configuration file control
+@table @option
+@opsummary{config-file, calloutd}
+@item --config-file=@var{file}
+Load this configuration file.
+
+@opsummary{config-lint, calloutd}
+@item --config-lint
+Check syntax of configuration files and exit. Exit code is 0 if the
+file or files are OK, and 78 otherwise.
+
+@opsummary{config-verbose, calloutd}
+@item --config-verbose
+Verbosely log parsing of the configuration files.
+
+@opsummary{no-site-config, calloutd}
+@item --no-site-config
+@itemx --no-config
+Don't load site-wide configuration file.
+
+@opsummary{set, calloutd}
+@item --set=@var{param}=@var{value}
+Set configuration parameter
+@end table
+
+@subheading Informational options
+@table @option
+@opsummary{config-help, calloutd}
+@item --config-help
+Show configuration file summary.
+
+@opsummary{show-config-options, calloutd}
+@item --show-config-options
+Show compilation options.
+
+@opsummary{help, calloutd}
+@item -?
+@itemx --help
+Give a short help list.
+
+@opsummary{usage, calloutd}
+@item --usage
+Give a short usage message.
+
+@opsummary{version, calloutd}
+@item -V
+@itemx --version
+Print program version
+@end table
+
@node protocol-calloutd
@@ -32,2 +191,84 @@ server running @command{mailfromd}.
+@deffn Command vrfy @var{email} [@var{option} @var{arg}]
+Adds @var{email} to the queue of email addresses to be verified.
+Available @var{option}s are:
+
+@table @option
+@item mode @var{kw}
+Sets verification mode for this email address. Available modes are:
+
+@table @asis
+@item mxfirst
+@itemx default
+The default mode.
+
+If the @code{host} option is also given, its argument is taken as
+the domain name. Otherwise, domain part of @var{email} is used.
+
+The verification goes as follows. First, determine MX servers for
+that domain. Query each of them in order of increasing priority.
+First of them that replies determines the result of the test.
+
+If no MX servers are defined for that domain, look for its @samp{A}
+record. If available, run SMTP probe on that IP.
+
+@item mxonly
+Query MX servers for the domain specified with the @code{host} option.
+
+@item hostonly
+Query the server whose name or IP address is supplied with the
+@code{host} option.
+
+@item hostfirst
+The reverse of @code{mxfirst}: first query the host, then the MX
+servers. The domain must be specified using the @code{host} option.
+@end table
+
+@item host @var{name}
+Supplies the domain name for @code{mxonly} and mode, and host name or
+IP address for @code{hostfirst} and @code{hostonly} modes. The use of
+this keyword with any of these modes is mandatory.
+
+@item ehlo @var{string}
+Use @var{string} as the argument to the SMTP @code{EHLO} command.
+
+@item mailfrom @var{email}
+Use @var{email} in the SMTP @code{MAIL FROM} command.
+@end table
+@end deffn
+
+@deffn Command get @var{arg} [@var{arg}]
+Query value of internal callout parameters. Valid values for
+@var{arg} are:
+
+@table @asis
+@item ehlo
+Return the string used as argument to the SMTP @code{EHLO} command.
+
+@item mailfromd
+Return the email address that is used in the SMTP @code{MAIL FROM} command.
+@end table
+@end deffn
+
+@deffn Command sid @var{string}
+Use @var{string} as session identifier for that session.
+@end deffn
+
+@deffn Command timeout @var{connect} @var{initial} @var{helo} @
+ @var{mail} @var{rcpt} @var{rset} @var{quit}
+Sets timeouts for various stages of SMTP session.
+@end deffn
+
+@deffn Command run
+Runs callout session for emails supplied with the @code{vrfy} command.
+@end deffn
+
+@deffn Command drop @var{serial}
+Drop the email with the given @var{serial} number from the
+verification queue.
+@end deffn
+
+@deffn Command quit
+Finishes the current session and disconnects from the callout server.
+@end deffn
diff --git a/doc/functions.texi b/doc/functions.texi
index b7b06696..a055f425 100644
--- a/doc/functions.texi
+++ b/doc/functions.texi
@@ -1417,2 +1417,3 @@ Return number of lines occupied by headers in message @var{nmsg}.
+@anchor{message_header_count}
@deftypefn {Built-in Function} number message_header_count (number @var{nmsg}, @
@@ -1621,6 +1622,80 @@ explanatory reason.
+@deftypefn {Library Function} number callout_open (string @var{url})
+Opens connection to the callout server listening at @var{url}.
+Returns the descriptor of the connection.
+@end deftypefn
+
+@deftypefn {Library Function} void callout_close(number @var{fd})
+Closes the connection. @var{fd} is the file descriptor returned by
+the previous call to @code{callout_open}.
+@end deftypefn
+
+@deftypefn {Library Function} number callout_do (number @var{fd}, @
+ string @var{email} [, string @var{rest}])
+Instructs the callout server identified by @var{fd} (a file descriptor
+returned by a previous call to @code{callout_open}) to verify the
+validity of the @var{email}. Optional @var{rest} argument supplies
+additional parameters for the server.
+
+Possible return values:
+
+@table @code
+@item 0
+Success. The @var{email} is found to be valid.
+@item e_not_found
+@var{email} does not exist.
+@item e_temp_failure
+The email validity cannot be determined right now, e.g. because remote
+SMTP server returned temporary failure. The caller should retry
+verification later.
+@item e_failure
+Some error occurred.
+@end table
+
+The function will throw the @code{e_callout_proto} exception if the
+remote host doesn't speak the correct callout protocol.
+
+Upon return, @code{callout_do} modifies the following variables:
+
+@table @code
+@item last_poll_host
+Host name or IP address of the last polled SMTP server.
+
+@item last_poll_greeting
+Initial SMTP reply from the last polled host.
+
+@item last_poll_helo
+The reply to the @code{HELO} (@code{EHLO}) command, received from the
+last polled host.
+
+@item last_poll_sent
+Last @acronym{SMTP} command sent to the polled host. If nothing was
+sent, @code{last_poll_sent} contains the string @samp{nothing}.
+
+@item last_poll_recv
+Last @acronym{SMTP} reply received from the remote host. In case of
+multi-line replies, only the first line is stored. If nothing was
+received the variable contains the string @samp{nothing}.
+@end table
+@end deftypefn
+
+The @dfn{default callout server} is defined by the @code{callout-url}
+statement in the configuration file, or by the @code{callout}
+statement in the @code{server milter} section (@pxref{configuring
+default callout server}. The following functions operate on that server.
+
@deftypefn {Built-in Function} string default_callout_server_url ()
-Returns URL of the default callout server. @FIXME{Add an xref.}
+Returns URL of the default callout server.
+@end deftypefn
+
+@deftypefn {Library Function} number __callout_open_default ()
+Opens connection to the default callout server. Returns file
+descriptor that can be used in subsequent calls to other callout
+functions.
@end deftypefn
+@deftypefn {Library Function} number callout(string @var{email})
+Verifies the validity of the @var{email} using the default callout
+server.
+@end deftypefn
@@ -1628,13 +1703,9 @@ Returns URL of the default callout server. @FIXME{Add an xref.}
@section Compatibility Callout Functions
-@anchor{Polling functions}
-@FIXME{Check references to 'Polling functions' anchor.}
-@UNREVISED
- We have described the base notions about sender address verification
-(or @dfn{polling}, for short) in @ref{Checking Sender Address}. Here
-we will describe the functions @command{mailfromd} offers for this
-purpose.
+ The following functions are wrappers over the callout functions
+described in the previous section. They are provided for backward
+compativbility.
@flindex poll.mf
- All functions described below are defined in the module @file{poll.mf},
-which you must require prior to using any of them.
+ These functions are defined in the module @file{poll.mf}, which you
+must require prior to using any of them.
@@ -4796,2 +4867,3 @@ work if a dedicated callout server is used for that purpose
+@anchor{debug_spec}
@deftypefn {Built-in Function} string debug_spec ([string @var{catnames}, @
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index d8ff6046..10f16615 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -2598,5 +2598,12 @@ socket: unix:/var/run/mailfromd/mailfrom
pidfile: /var/run/mailfromd/mailfromd.pid
-database format: Berkeley DB 2.x
+default syslog: blocking
+supported databases: gdbm, bdb
+default database type: bdb
+optional features: GeoIP
+greylist database: /var/run/mailfromd/greylist.db
+greylist expiration: 86400
tbf database: /var/run/mailfromd/tbf.db
tbf expiration: 86400
+rate database: /var/run/mailfromd/rates.db
+rate expiration: 86400
cache database: /var/run/mailfromd/mailfromd.db
@@ -2604,6 +2611,2 @@ cache positive expiration: 86400
cache negative expiration: 43200
-greylist database: /var/run/mailfromd/greylist.db
-greylist expiration: 86400
-rate database: /var/run/mailfromd/rates.db
-rate expiration: 86400
@end group
@@ -2611,3 +2614,3 @@ rate expiration: 86400
- The text below @samp{database format} line describes the available
+ The text below @samp{optional features} line describes the available
built-in databases. Notice that the @samp{cache} database, in
@@ -3106,3 +3109,3 @@ following line would most probably fail to be executed properly:
@example
-#! /usr/sbin/mailfromd --no-user-conf --run
+#! /usr/sbin/mailfromd --no-config --run
@end example
@@ -3130,3 +3133,3 @@ invoking the interpreter itself. For example:
#!/bin/sh
-exec /usr/sbin/mailfromd --no-user-conf --run $0 $@@
+exec /usr/sbin/mailfromd --no-config --run $0 $@@
!#
@@ -3603,3 +3606,3 @@ internal structure to use this form of the @option{--debug} option.
To control the execution of the sender verification functions
-(@pxref{Polling functions}), you may use
+(@pxref{SMTP Callout functions}), you may use
@option{--transcript} (@option{-X}) command line option which enables
@@ -4993,3 +4996,3 @@ This variable is set by @code{stdpoll} and @code{strictpoll} built-ins
polling the host, and @samp{0} if the polling took place.
-@xref{Polling functions}.
+@xref{SMTP Callout functions}.
@@ -5052,3 +5055,3 @@ qualified domain name of the host where @command{mailfromd} is run.
@deftypevar {Predefined Variable} string last_poll_greeting
-Polling functions (@pxref{Polling functions}) set this variable before
+Callout functions (@pxref{SMTP Callout functions}) set this variable before
returning. It contains the initial SMTP reply from the last polled
@@ -5058,3 +5061,3 @@ host.
@deftypevar {Predefined Variable} string last_poll_helo
-Polling functions (@pxref{Polling functions}) set this variable before
+Callout functions (@pxref{SMTP Callout functions}) set this variable before
returning. It contains the reply to the @code{HELO} (@code{EHLO})
@@ -5064,4 +5067,5 @@ command, received from the last polled host.
@deftypevar {Predefined Variable} string last_poll_host
-Polling functions (@pxref{Polling functions}) set this variable before
-returning. It contains the host name or @acronym{IP} address of the last polled host.
+Callout functions (@pxref{SMTP Callout functions}) set this variable before
+returning. It contains the host name or @acronym{IP} address of the
+last polled host.
@end deftypevar
@@ -5069,3 +5073,3 @@ returning. It contains the host name or @acronym{IP} address of the last polled
@deftypevar {Predefined Variable} string last_poll_recv
-Polling functions (@pxref{Polling functions}) set this variable before
+Callout functions (@pxref{SMTP Callout functions}) set this variable before
returning. It contains the last @acronym{SMTP} reply received from
@@ -5076,6 +5080,6 @@ stored. If nothing was received the variable contains the string
-@deftypevar {Predefined Variable} string last_poll_send
-Polling functions (@pxref{Polling functions}) set this variable before
+@deftypevar {Predefined Variable} string last_poll_sent
+Callout functions (@pxref{SMTP Callout functions}) set this variable before
returning. It contains the last @acronym{SMTP} command sent to the
-polled host. If nothing was sent, @code{last_poll_send} contains the string
+polled host. If nothing was sent, @code{last_poll_sent} contains the string
@samp{nothing}.
@@ -7770,3 +7774,3 @@ previously using a @code{dclex} statement).
sender address verification or @dfn{polling}, for short. These
-functions, which were described in @ref{Polling functions}, can be
+functions, which were described in @ref{SMTP Callout functions}, can be
used to implement any sender verification method. The additional data
@@ -9026,2 +9030,3 @@ server @var{type} @{
default @var{bool};
+ callout @var{url};
acl @{ @dots{} @}
@@ -9103,3 +9108,4 @@ for all milter servers declared in the configuration.
statement to query a remote callout server:
-
+
+@anchor{configuring default callout server}
@deffn {server} callout url
@@ -9684,4 +9690,4 @@ described in @ref{conf-base, state-directory}.
@opsummary{source-ip, mailfromd}
-@item -S
-@itemx --source-ip
+@item -S @var{ip}
+@itemx --source-ip=@var{ip}
Set source address for @acronym{TCP} connections. Overrides the
@@ -9771,4 +9777,7 @@ configuration file statement, which you are advised to use instead
@opsummary{location-column, mailfromd}
+@item --location-column
+@itemx --no-location-column
Mention column number in error messages. @xref{Testing Filter
-Scripts,, location-column}.
+Scripts,, location-column}. Use @option{--no-location-column} to
+disable
@@ -9833,5 +9842,7 @@ else but for debugging, as it terribly degrades performance!
@item --stack-trace
+@itemx --no-stack-trace
Add @acronym{MFL} stack trace information to runtime error output.
-Overrides @code{stack-trace} configuration statement, which you are
-advised to use instead (@pxref{conf-debug, stack-trace}).
+Overrides @code{stack-trace} configuration statement. Use the
+@option{--no-stack-trace} to disable trace information.
+
@xref{tracing runtime errors}, for more information on this feature.
@@ -9906,2 +9917,3 @@ Tag syslog entries with the given @var{string}, instead of the program name.
@item --source-info
+@itemx --no-source-info
Include @sc{c} source information in debugging messages. This is
@@ -9910,2 +9922,5 @@ configuration block (@FIXME-pxref{debug configuration}).
+The @option{--no-source-info} can be used to cancel the effect of the
+@code{line-info yes} configuration statement.
+
You do not need this option, unless you are developing or debugging
@@ -9919,4 +9934,6 @@ Synonym for @option{--lint}.
@item --trace
-Enable action tracing. With this option @command{mailfromd} will log
-all executed actions. @xref{Logging and Debugging}.
+@item --no-trace
+Enable or disable action tracing. If @option{--trace} is given,
+@command{mailfromd} will log all executed actions. @xref{Logging and
+Debugging}.
@@ -9938,3 +9955,4 @@ advised to use otherwise, since it is very time-costly.
@itemx --transcript
-Enable transcript of the @acronym{SMTP} sessions to the log
+@itemx --no-transcript
+Enable or disable transcript of the @acronym{SMTP} sessions to the log
channel. @xref{Logging and Debugging}.
@@ -9946,2 +9964,3 @@ Selects default syslog mechanism for diagnostic output.
@opsummary{stderr, mailfromd}
+@item --stderr
Directs all logging to standard output. Similar to @option{--logger=stderr}.
diff --git a/doc/upgrade.texi b/doc/upgrade.texi
index bb00aabf..39589d04 100644
--- a/doc/upgrade.texi
+++ b/doc/upgrade.texi
@@ -30,3 +30,46 @@ between the consecutive Mailfromd releases.
@cindex Upgrading from 7.0 to 8.0
-@WRITEME
+
+ Version 8.0 is a major rewrite, that introduces a lot of new
+concepts and features. Nevertheless, it is still able to run
+the MFL scripts from version 7.0 without modifications.
+
+Note the following important points:
+
+@itemize @bullet
+@item The @code{listen} configuration statement withdrawn
+
+Use the @code{server milter} statement instead. @xref{conf-server}.
+
+@item The @option{--remove} option withdrawn
+
+This option was a noop since version 7.0.91.
+
+@item The use of @samp{%} before variable names is no longer supported
+
+The @samp{%} characters is used as modulo operator. @xref{Arithmetic
+operations}.
+
+@item The @code{debug_spec} built-in function changed signature.
+
+@xref{debug_spec}.
+
+@item @code{listens} and @code{portprobe}
+
+The @code{listens} function was moved to the @file{portprobe} module. It is
+actually an alias to the @code{portprobe} function. If your filter uses
+@code{listens}, make sure to @code{require} the @file{portprobe}
+module.
+
+@xref{Special test functions, portprobe}.
+
+@item @code{_pollhost}, @code{_pollmx}, @code{stdpoll}, @code{strictpoll}
+
+These functions have been moved to the @file{poll} module, which must be
+required prior to using any of them.
+
+@item The @code{message_header_count} function.
+
+This function takes an optional string argument, supplying the header
+name. @xref{message_header_count}.
+@end itemize
diff --git a/etc/Makefile.am b/etc/Makefile.am
index da020d58..2337f557 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -42,3 +42,3 @@ SUFFIXES = .mf .lint
$(MF_LINT)$(top_builddir)/src/mailfromd \
- --no-site-config --no-user-config \
+ --no-config \
-I$(top_srcdir)/mflib \
diff --git a/lib/mfgetopt.c b/lib/mfgetopt.c
index c90eb103..c9a28289 100644
--- a/lib/mfgetopt.c
+++ b/lib/mfgetopt.c
@@ -31,4 +31,4 @@ mf_getopt(struct mu_cli_setup *cli, int *pargc, char ***pargv, char **capa,
if (cfile) {
- cfhint.site_rcfile = (char*) cfile;
- cfhint.flags |= MU_CFG_PARSE_SITE_RCFILE;
+ cfhint.site_file = (char*) cfile;
+ cfhint.flags |= MU_CFHINT_SITE_FILE;
}
diff --git a/mflib/Makefile.am b/mflib/Makefile.am
index d1f32a3c..e2df194a 100644
--- a/mflib/Makefile.am
+++ b/mflib/Makefile.am
@@ -92,3 +92,3 @@ MF_LINT_0 = @echo LINT $<;
$(MF_LINT)$(top_builddir)/src/mailfromd \
- --no-site-config --no-user-config \
+ --no-config \
-I$(top_srcdir)/mflib \
diff --git a/src/main.c b/src/main.c
index 18785afa..ab9315fe 100644
--- a/src/main.c
+++ b/src/main.c
@@ -933,2 +933,14 @@ mf_runtime_param_finish()
/* Auxiliary functions */
+unsigned keyword_column = 0;
+unsigned header_column = 2;
+unsigned value_column = 32;
+unsigned right_margin = 79;
+
+static void
+set_column(mu_stream_t str, unsigned margin)
+{
+ mu_stream_ioctl(str, MU_IOCTL_WORDWRAPSTREAM,
+ MU_IOCTL_WORDWRAP_SET_MARGIN,
+ &margin);
+}
@@ -937,11 +949,24 @@ db_format_enumerator(struct db_format *fmt, void *data)
{
- printf("%s database: %s\n", fmt->name, fmt->dbname);
+ mu_stream_t str = data;
+
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s database:", fmt->name);
+ set_column(str, value_column);
+ mu_stream_printf(str, "%s\n", fmt->dbname);
+
+ set_column(str, keyword_column);
if (strcmp(fmt->name, "cache") == 0) {
- printf("%s positive expiration: %lu\n", fmt->name,
- fmt->expire_interval);
- printf("%s negative expiration: %lu\n", fmt->name,
- negative_expire_interval);
- } else
- printf("%s expiration: %lu\n", fmt->name,
- fmt->expire_interval);
+ mu_stream_printf(str, "%s positive expiration:", fmt->name);
+ set_column(str, value_column);
+ mu_stream_printf(str, "%lu\n", fmt->expire_interval);
+
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s negative expiration:", fmt->name);
+ set_column(str, value_column);
+ mu_stream_printf(str, "%lu\n", negative_expire_interval);
+ } else {
+ mu_stream_printf(str, "%s expiration:", fmt->name);
+ set_column(str, value_column);
+ mu_stream_printf(str, "%lu\n", fmt->expire_interval);
+ }
return 0;
@@ -950,3 +975,3 @@ db_format_enumerator(struct db_format *fmt, void *data)
static void
-list_db_formats(const char *pfx)
+list_db_formats(mu_stream_t str, const char *pfx)
{
@@ -955,7 +980,11 @@ list_db_formats(const char *pfx)
const char *defdb = DEFAULT_DB_TYPE;
- printf("%s", pfx);
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s:", pfx);
+
+ set_column(str, value_column);
+
rc = mu_dbm_impl_iterator(&itr);
if (rc) {
- printf("%s\n", _("unknown"));
+ mu_stream_printf(str, "%s\n", _("unknown"));
mu_error("%s", mu_strerror(rc));
@@ -969,41 +998,119 @@ list_db_formats(const char *pfx)
if (i)
- printf(", ");
+ mu_stream_printf(str, ", ");
else if (!defdb)
defdb = impl->_dbm_name;
- printf("%s", impl->_dbm_name);
+ mu_stream_printf(str, "%s", impl->_dbm_name);
}
- putchar('\n');
+ mu_stream_write(str, "\n", 1, NULL);
mu_iterator_destroy(&itr);
}
- printf("default database type: %s\n", defdb);
+
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s:", "default database type");
+ set_column(str, value_column);
+ mu_stream_printf(str, "%s\n", defdb);
}
-void
-mailfromd_show_defaults()
+struct string_value {
+ char const *kw;
+ int type;
+ union {
+ char *s_const;
+ char **s_var;
+ char *(*s_func) (void);
+ } data;
+};
+
+static char *
+string_preprocessor (void)
{
- printf("version: %s\n", VERSION);
- printf("script file: %s\n", script_file);
- printf("preprocessor: %s\n", ext_pp ? ext_pp : "none");
- printf("user: %s\n", mf_server_user);
- printf("statedir: %s\n", mailfromd_state_dir);
- printf("socket: %s\n", DEFAULT_SOCKET);
- printf("pidfile: %s\n", pidfile);
+ return ext_pp ? ext_pp : "none";
+}
+
#ifdef USE_SYSLOG_ASYNC
-#if DEFAULT_SYSLOG_ASYNC == 1
- printf("default syslog: non-blocking\n");
+# if DEFAULT_SYSLOG_ASYNC == 1
+# define DEFAULT_SYSLOG "non-blocking"
+# else
+# define DEFAULT_SYSLOG "blocking"
+# endif
#else
- printf("default syslog: blocking\n");
+# define DEFAULT_SYSLOG "blocking"
#endif
-#endif
- list_db_formats("supported databases: ");
- printf("Optional features: ");
+
+enum {
+ STRING_CONSTANT,
+ STRING_VARIABLE,
+ STRING_FUNCTION
+};
+
+static struct string_value string_values[] = {
+ { "version", STRING_CONSTANT, { .s_const = VERSION } },
+ { "script file", STRING_VARIABLE, { .s_var = &script_file } },
+ { "preprocessor", STRING_FUNCTION, { .s_func = string_preprocessor } },
+ { "user", STRING_VARIABLE, { .s_var = &mf_server_user } },
+ { "statedir", STRING_VARIABLE, { .s_var = &mailfromd_state_dir } },
+ { "socket", STRING_CONSTANT, { .s_const = DEFAULT_SOCKET } },
+ { "pidfile", STRING_VARIABLE, { .s_var = &pidfile } },
+ { "default syslog", STRING_CONSTANT, { .s_const = DEFAULT_SYSLOG } },
+ { NULL }
+};
+
+static void
+print_string_values(mu_stream_t str)
+{
+ struct string_value *p;
+ char const *val;
+
+ for (p = string_values; p->kw; p++) {
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s:", p->kw);
+
+ switch (p->type) {
+ case STRING_CONSTANT:
+ val = p->data.s_const;
+ break;
+
+ case STRING_VARIABLE:
+ val = *p->data.s_var;
+ break;
+
+ case STRING_FUNCTION:
+ val = p->data.s_func ();
+ }
+
+ set_column(str, value_column);
+ mu_stream_printf(str, "%s\n", val);
+ }
+}
+
+void
+mailfromd_show_defaults(void)
+{
+ int rc;
+ mu_stream_t str;
+
+ rc = mu_wordwrap_stream_create (&str, mu_strout, 0, right_margin);
+ if (rc) {
+ str = mu_strout;
+ mu_stream_ref(str);
+ }
+
+ print_string_values(str);
+
+ list_db_formats(str, "supported databases");
+
+ set_column(str, keyword_column);
+ mu_stream_printf(str, "%s:", "optional features");
+ set_column(str, value_column);
#if defined WITH_GEOIP
- printf(" GeoIP");
+ mu_stream_printf(str, " %s", "GeoIP");
#endif
#if defined WITH_DSPAM
- printf(" DSPAM");
+ mu_stream_printf(str, " %s", "DSPAM");
#endif
- printf("\n");
+ mu_stream_write(str, "\n", 1, NULL);
+
+ db_format_enumerate(db_format_enumerator, str);
- db_format_enumerate(db_format_enumerator, NULL);
+ mu_stream_destroy (&str);
}
diff --git a/tests/atlocal.in b/tests/atlocal.in
index a0bd3d8c..e46d17bd 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -25,3 +25,3 @@ trap "cleanup; test -r $XFAILFILE && cat $XFAILFILE; exit $?" 1 2 13 15
-MFOPTS="-I@abs_builddir@ -I@abs_builddir@/etc -I@abs_top_srcdir@/tests/etc -I@abs_top_srcdir@/src -I@abs_top_srcdir@/mflib --no-preprocess --no-site-rcfile --no-user-rcfile"
+MFOPTS="-I@abs_builddir@ -I@abs_builddir@/etc -I@abs_top_srcdir@/tests/etc -I@abs_top_srcdir@/src -I@abs_top_srcdir@/mflib --no-preprocess --no-config"
MFADDOPTS=
diff --git a/tests/shellmagic.at b/tests/shellmagic