summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2016-11-02 13:44:27 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-11-02 13:44:27 (GMT)
commit38e58d3662ac6c2e53e9ec8b85934e0e23a199c0 (patch) (side-by-side diff)
tree13eb93e3ff14c94ccdcaa13a0a85ed883ece438a
parentf7ea305fee69c0814a075d01b2b92a153916f093 (diff)
downloadmailfromd-38e58d3662ac6c2e53e9ec8b85934e0e23a199c0.tar.gz
mailfromd-38e58d3662ac6c2e53e9ec8b85934e0e23a199c0.tar.bz2
Follow Mailutils commit dc62b399
Diffstat (more/less context) (ignore whitespace changes)
-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 c96c030..a875321 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-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.
@@ -7,14 +7,23 @@ 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
@@ -65,7 +74,7 @@ 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(...)
@@ -503,10 +512,9 @@ following sub-statement:
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>;
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 9a9b611..d97a214 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -47,7 +47,7 @@ check-options: check-mailfromd-options check-calloutd-options check-mfdbtool-opt
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 - \
@@ -55,7 +55,7 @@ check-mailfromd-options:
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 - \
@@ -63,7 +63,7 @@ check-calloutd-options:
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 - \
diff --git a/doc/calloutd.texi b/doc/calloutd.texi
index 67597fe..9e1c9ce 100644
--- a/doc/calloutd.texi
+++ b/doc/calloutd.texi
@@ -5,9 +5,9 @@
@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.
@@ -26,8 +26,249 @@ server running @command{mailfromd}.
@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 b7b0669..a055f42 100644
--- a/doc/functions.texi
+++ b/doc/functions.texi
@@ -1415,6 +1415,7 @@ note to the @code{message_size}, above.
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}.
@@ -1619,24 +1620,94 @@ explanatory reason.
@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}, @
@@ -4794,6 +4865,7 @@ 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
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index d8ff604..10f1661 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -2596,20 +2596,23 @@ 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.
@@ -3104,7 +3107,7 @@ often make it impossible to pass additional arguments to
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
@@ -3128,7 +3131,7 @@ 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(...)
@@ -3601,7 +3604,7 @@ 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}:
@@ -4991,7 +4994,7 @@ 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
@@ -5050,34 +5053,35 @@ qualified domain name of the host where @command{mailfromd} is run.
@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
@@ -7768,7 +7772,7 @@ previously using a @code{dclex} statement).
@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}
@@ -9024,6 +9028,7 @@ server @var{type} @{
single-process @var{bool};
reuseaddr @var{bool};
default @var{bool};
+ callout @var{url};
acl @{ @dots{} @}
@}
@end group
@@ -9101,7 +9106,8 @@ for all milter servers declared in the configuration.
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
@@ -9682,8 +9688,8 @@ 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}).
@@ -9769,8 +9775,11 @@ configuration file statement, which you are advised to use instead
@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}
@@ -9831,9 +9840,11 @@ 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}
@@ -9904,10 +9915,14 @@ 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}.
@@ -9917,8 +9932,10 @@ 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}]
@@ -9936,7 +9953,8 @@ 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}
@@ -9944,6 +9962,7 @@ channel. @xref{Logging and Debugging}.
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}
diff --git a/doc/upgrade.texi b/doc/upgrade.texi
index bb00aab..39589d0 100644
--- a/doc/upgrade.texi
+++ b/doc/upgrade.texi
@@ -28,7 +28,50 @@ between the consecutive Mailfromd releases.
@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
diff --git a/etc/Makefile.am b/etc/Makefile.am
index da020d5..2337f55 100644
--- a/etc/Makefile.am
+++ b/etc/Makefile.am
@@ -40,7 +40,7 @@ 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 $<
diff --git a/lib/mfgetopt.c b/lib/mfgetopt.c
index c90eb10..c9a2828 100644
--- a/lib/mfgetopt.c
+++ b/lib/mfgetopt.c
@@ -29,8 +29,8 @@ mf_getopt(struct mu_cli_setup *cli, int *pargc, char ***pargv, char **capa,
cfhint.flags = 0;
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;
}
pohint.po_flags = 0;
diff --git a/mflib/Makefile.am b/mflib/Makefile.am
index d1f32a3..e2df194 100644
--- a/mflib/Makefile.am
+++ b/mflib/Makefile.am
@@ -90,7 +90,7 @@ MF_LINT_0 = @echo 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 $<
diff --git a/src/main.c b/src/main.c
index 18785af..ab9315f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -931,33 +931,62 @@ 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);
+}
static int
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;
}
static void
-list_db_formats(const char *pfx)
+list_db_formats(mu_stream_t str, const char *pfx)
{
mu_iterator_t itr;
int rc;
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));
} else {
int i;
@@ -967,45 +996,123 @@ list_db_formats(const char *pfx)
mu_iterator_current(itr, (void**)&impl);
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);
}
static int
diff --git a/tests/atlocal.in b/tests/atlocal.in
index a0bd3d8..e46d17b 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -23,7 +23,7 @@ cleanup() {
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=
TESTDIR=@abs_builddir@
ETCDIR=@abs_top_srcdir@/tests/etc
diff --git a/tests/shellmagic.at b/tests/shellmagic.at
index 2d5e6d1..0c9a9ee 100644
--- a/tests/shellmagic.at
+++ b/tests/shellmagic.at
@@ -21,7 +21,7 @@ AT_CHECK([
[cat > mfs.sh <<_EOT
#! /bin/sh
# Apart from this initial boilerplace this is actually a -*- mfl -*- code.
-exec $MAILFROMD --no-site-config --no-user-config --run \$0 "\$@"
+exec $MAILFROMD --no-config --run \$0 "\$@"
!#
func main(...)
returns number

Return to:

Send suggestions and report system problems to the System administrator.