aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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,23 +1,32 @@
-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
See the end of file for copying conditions.
Please send Mailfromd bug reports to <bug-mailfromd@gnu.org.ua>
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:
* Requires Mailutils 3.0
-* 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
** enable-vrfy
The `enable-vrfy' statement enables the use of SMTP VRFY statement
prior to normal callout sequence. If VRFY is supported by the remote
@@ -62,13 +71,13 @@ on a line by themselves.
This feature allows for compensating for the deficiences of the
traditional `#!' script magic. For example, if a mailfromd script
must be invoked with some additional option passed to mailfromd (say
--no-user-conf), it can now be written as:
#!/bin/sh
- exec /usr/sbin/mailfromd --no-user-conf --run $0 $@
+ exec /usr/sbin/mailfromd --no-config --run $0 $@
!#
func main(...)
returns number
do
...
@@ -500,16 +509,15 @@ following sub-statement:
default <arg: boolean>;
When arg is `yes', this server is marked as the default callout server
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:
callout-url <url: string>;
* Timeout control for callout SMTP sessions
Callout SMTP sessions initiated by polling functions are controlled
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9a9b6116..d97a2141 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -44,29 +44,29 @@ CHECK_DOCS=$(top_srcdir)/@IMPRIMATUR_MODULE_DIR@/check-docs.sh
# Checking
check-options: check-mailfromd-options check-calloutd-options check-mfdbtool-options
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' \
$(top_srcdir)/src/main.c $(top_srcdir)/src/srvcfg.c -- \
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -E - \
$(info_TEXINFOS)
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' \
$(top_srcdir)/src/calloutd.c $(top_srcdir)/src/srvcfg.c -- \
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -E - \
$(info_TEXINFOS)
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' \
$(top_srcdir)/src/mfdbtool.c -- \
$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -E - \
$(info_TEXINFOS)
check-config:
diff --git a/doc/calloutd.texi b/doc/calloutd.texi
index 67597fe4..9e1c9ce2 100644
--- a/doc/calloutd.texi
+++ b/doc/calloutd.texi
@@ -2,15 +2,15 @@
@c Copyright (C) 2011, 2014-2016 Sergey Poznyakoff
@c See file mailfromd.texi for copying conditions.
@c *******************************************************************
@pindex calloutd
Usually callout verification is performed by a special instance of
@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}.
This stand-alone callout facility is provided by the
@command{calloutd} daemon.
@menu
* config-calloutd:: Calloutd Configuration.
@@ -23,11 +23,252 @@ server running @command{mailfromd}.
@WRITEME
@node invocation-calloutd
@section Calloutd Command-Line Options
@WRITEME
+@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
@section The Callout Protocol
@WRITEME
+@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
@@ -1412,12 +1412,13 @@ note to the @code{message_size}, above.
@end deftypefn
@deftypefn {Built-in Function} number message_header_lines (number @var{nmsg})
Return number of lines occupied by headers in message @var{nmsg}.
@end deftypefn
+@anchor{message_header_count}
@deftypefn {Built-in Function} number message_header_count (number @var{nmsg}, @
[string @var{name}])
Return number of headers in message @var{nmsg}.
If @var{name} is supplied, count only headers with that name.
@end deftypefn
@@ -1616,30 +1617,100 @@ explanatory reason.
@end deftypefn
@node SMTP Callout functions
@section SMTP Callout Functions
@UNREVISED
+@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
@node Compatibility Callout functions
@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.
@deftypefn {Library Function} number _pollhost @
(string @var{ip}, string @var{email}, string @var{domain}, @
string @var{mailfrom})
Poll @acronym{SMTP} host @var{ip} for email address @var{email},
using @var{domain} as @code{EHLO} domain and @var{mailfrom} as
@@ -4791,12 +4862,13 @@ Note, that the use of this function (as well as the use of the
@option{--transcript} option) makes sense only if callouts are
performed by the @command{mailfromd} daemon itself. It will not
work if a dedicated callout server is used for that purpose
(@pxref{calloutd}).
@end deftypefn
+@anchor{debug_spec}
@deftypefn {Built-in Function} string debug_spec ([string @var{catnames}, @
bool @var{showunset}])
Returns the current debugging level specification, as given by
@option{--debug} command line option or by the @code{debug} configuration
statement (@pxref{conf-debug}).
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index d8ff6046..10f16615 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -2593,26 +2593,29 @@ version: @value{VERSION}
script file: /etc/mailfromd.mf
preprocessor: /usr/bin/m4 -s
user: mail
statedir: /var/run/mailfromd
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
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
@end smallexample
- 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
contrast to the rest of databases, has two expiration periods
associated with it. This is explained in the next subsection.
@menu
* Database Formats::
@@ -3101,13 +3104,13 @@ after the interpreter name as a single argument, some others silently
truncate the command line after some number of characters, etc. This
often make it impossible to pass additional arguments to
@command{mailfromd}. For example, a script which begins with the
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
@cindex @samp{#! ... !#} initial comment
To compensate for these deficiences and to allow for more complex
invocation sequences, @command{mailfromd} handles initial @samp{#}
in a special way. If the first line of a source file begins with
@@ -3125,13 +3128,13 @@ Thus, the correct way to begin a @command{mailfromd} script is:
Using this feature, you can start the @command{mailfromd} with
arbitrary shell code, provided it ends with an @code{exec} statement
invoking the interpreter itself. For example:
@example
#!/bin/sh
-exec /usr/sbin/mailfromd --no-user-conf --run $0 $@@
+exec /usr/sbin/mailfromd --no-config --run $0 $@@
!#
func main(...)
returns number
do
/* actual mfl code goes here */
@@ -3598,13 +3601,13 @@ $ mailfromd --debug='engine.trace2;savsrv;srvman.trace0'
You need to have sufficient knowledge about @command{mailfromd}
internal structure to use this form of the @option{--debug} option.
@anchor{SMTP transcript}
@xopindex{transcript, mailfromd, introduced}
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
transcripts of @acronym{SMTP} sessions in the logs. Here is an example
of the output produced running @kbd{mailfromd --transcript}:
@xopindex{transcript, mailfromd, output example}
@smallexample
@@ -4988,13 +4991,13 @@ explicitly or implicitly).
@deftypevar {Predefined Variable} number cache_used
This variable is set by @code{stdpoll} and @code{strictpoll} built-ins
(and, consequently, by the @code{on poll} statement). Its value is
@samp{1} if the function used the cached data instead of directly
polling the host, and @samp{0} if the polling took place.
-@xref{Polling functions}.
+@xref{SMTP Callout functions}.
@anchor{cache_used example}
@cindex @code{cache_used} variable, usage example
@cindex reject messages, marking cached rejects
You can use this variable to make your reject message more informative
for the remote party. The common paradigm is to define a function,
@@ -5047,40 +5050,41 @@ functions}).
@code{EHLO} or @code{HELO} command. Default value is the fully
qualified domain name of the host where @command{mailfromd} is run.
@xref{Polling}.
@end deftypevr
@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
host.
@end deftypevar
@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})
command, received from the last polled host.
@end deftypevar
@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
@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
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 deftypevar
-@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}.
@end deftypevar
@anchor{mailfrom_address}
@deftypevr {Predefined Variable} string mailfrom_address
Email address used by polling functions in @acronym{SMTP} @code{MAIL
@@ -7765,13 +7769,13 @@ previously using a @code{dclex} statement).
@node Polling
@section Sender Verification Tests
@cindex sender verification, writing tests
The filter script language provides a wide variety of functions for
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
that can be needed is normally supplied by two global variables:
@code{ehlo_domain}, keeping the default domain for the @code{EHLO}
command, and @code{mailfrom_address}, which stores the sender address
for probe messages (@pxref{Predefined variables}).
@@ -9021,12 +9025,13 @@ server @var{type} @{
listen @var{url};
backlog @var{num};
max-instances @var{num};
single-process @var{bool};
reuseaddr @var{bool};
default @var{bool};
+ callout @var{url};
acl @{ @dots{} @}
@}
@end group
@end smallexample
@deffn {Mailfromd Conf} server @var{type}
@@ -9098,13 +9103,14 @@ is also allowed:
When set to @samp{yes}, this server is marked as a default callout server
for all milter servers declared in the configuration.
@end deffn
if the server @var{type} is @samp{milter}, you can use the following
statement to query a remote callout server:
-
+
+@anchor{configuring default callout server}
@deffn {server} callout url
Use a callout server at @var{url} (@pxref{milter port specification}).
@end deffn
You can also set a @dfn{global callout server}, which will be used
by all milter servers that do not set the @code{callout} statement:
@@ -9679,14 +9685,14 @@ relayed-domain-file}), which you are advised to use instead.
Set new program state directory. @xref{statedir, Local state directory}, for
the description of this directory and its purposes. This option
overrides the settings of @code{state-directory} configuration statement,
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
@samp{source-ip} configuration statement, which you are advised to use
instead (@pxref{conf-base, source-ip}).
@opsummary{user, mailfromd}
@item -u @var{name}
@@ -9766,14 +9772,17 @@ configuration file statement, which you are advised to use instead
@node Logging and Debugging Options
@subsection Logging and Debugging Options
@table @option
@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
@opsummary{debug, mailfromd}
@item -d @var{string}
@itemx --debug=@var{string}
Set debugging level. @xref{Logging and Debugging}.
@@ -9828,15 +9837,17 @@ with code 78 (@samp{configuration error}).
Do not fork sub-processes to serve requests. This option is meant to
assist in debugging @command{mailfromd}. Don't use it for anything
else but for debugging, as it terribly degrades performance!
@opsummary{stack-trace, mailfromd}
@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.
@anchor{gacopyz-log option}
@opsummary{gacopyz-log, mailfromd}
@item --gacopyz-log=@var{level}
Set desired logging level for @command{gacopyz} library
@@ -9901,27 +9912,33 @@ Output logs to syslog @var{facility}.
@opsummary{log-tag, mailfromd}
@item --log-tag=@var{string}
Tag syslog entries with the given @var{string}, instead of the program name.
@opsummary{source-info, mailfromd}
@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{mailfromd}.
@opsummary{syntax-check, mailfromd}
@item --syntax-check
Synonym for @option{--lint}.
@opsummary{trace, mailfromd}
@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}.
@opsummary{trace-program, mailfromd}
@item --trace-program[=@var{string}]
Enable program instruction tracing. With this option
@command{mailfromd} will log execution of every instruction in the
compiled filter program. The optional arguments allows to specify a
@@ -9933,20 +9950,22 @@ tracing for functions from modules @file{bi_io.c} and @file{bi_db.c}
This option is useful for debugging @command{mailfromd}, but is not
advised to use otherwise, since it is very time-costly.
@opsummary{transcript, mailfromd}
@item -X
@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}.
@opsummary{syslog, mailfromd}
@item --syslog
Selects default syslog mechanism for diagnostic output.
@opsummary{stderr, mailfromd}
+@item --stderr
Directs all logging to standard output. Similar to @option{--logger=stderr}.
@opsummary{xref, mailfromd}
@item --xref
Same as @option{--dump-xref}. @xref{Logging and Debugging}.
diff --git a/doc/upgrade.texi b/doc/upgrade.texi
index bb00aabf..39589d04 100644
--- a/doc/upgrade.texi
+++ b/doc/upgrade.texi
@@ -25,13 +25,56 @@ between the consecutive Mailfromd releases.
* 1x-2x:: Upgrading from 1.x to 2.x
@end menu
@node 700-800
@appendixsec Upgrading from 7.0 to 8.0
@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
@node 600-700
@appendixsec Upgrading from 6.0 to 7.0
@cindex Upgrading from 6.0 to 7.0
The release 7.0 removes the features which were declared as obsolete
diff --git a/etc/Makefile.am b/etc/Makefile.am
index da020d58..2337f557 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -37,13 +37,13 @@ MF_LINT_ = $(MF_LINT_$(AM_DEFAULT_VERBOSITY))
MF_LINT_0 = @echo LINT $<;
SUFFIXES = .mf .lint
.mf.lint:
$(MF_LINT)$(top_builddir)/src/mailfromd \
- --no-site-config --no-user-config \
+ --no-config \
-I$(top_srcdir)/mflib \
-I$(top_builddir)/mflib \
--lint $<
check-am: mailfromd.lint
diff --git a/lib/mfgetopt.c b/lib/mfgetopt.c
index c90eb103..c9a28289 100644
--- a/lib/mfget