diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-04-28 09:52:10 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2007-04-28 09:52:10 +0000 |
commit | 377b343c4cddcb59001388a9fea0a1d504f18c08 (patch) | |
tree | 96e5137e89889d817373a06d50b57b7f71896cd9 | |
parent | 626bca37562b1a70eb657faa1c1827856fae85eb (diff) | |
download | mailfromd-377b343c4cddcb59001388a9fea0a1d504f18c08.tar.gz mailfromd-377b343c4cddcb59001388a9fea0a1d504f18c08.tar.bz2 |
Synchronize with the trunk
git-svn-id: file:///svnroot/mailfromd/branches/alpha_3_1_91_berkeley_txn@1391 7a8a7f39-df28-0410-adc6-e0d955640f24
59 files changed, 2200 insertions, 995 deletions
@@ -1,5 +1,19 @@ +2007-04-25 Sergey Poznyakoff <gray@gnu.org.ua> + + Synchronize with the trunk + 2007-04-18 Sergey Poznyakoff <gray@gnu.org.ua> + * src/mu_dbm.c: When possible lock BDB databases directly. + For version 2.x fall back to external lock method. + + * src/snarf.m4 (MF_DEFINED, MF_OPTVAL): New macros + * src/bi_string.m4, src/bi_dns.m4, src/bi_mail.m4, + src/bi_db.m4: Use MF_DEFINED and MF_OPTVAL to test values of + the optional variables. + * src/main.c: New option --state-directory + * doc/mailfromd.texi: Revert the description of `#pragma option' + * src/gram.y (apply_deferred_init): Fix error messages * src/mailfromd.h, src/prog.c, src/main.c, src/bi_other.m4, NEWS: Implement stack traces. @@ -1,11 +1,35 @@ -Mailfromd NEWS -- history of user-visible changes. 2007-04-17 +Mailfromd NEWS -- history of user-visible changes. 2007-04-25 Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff See the end of file for copying conditions. Please send mailfromd bug reports to <bug-mailfromd@gnu.org.ua> + + +Version 3.1.92, SVN + +* mtasim + + The `mtasim' utility is an MTA simulator for testing and debugging +mailfromd filter scripts. It supports stdio (-bs) and daemon (-bd) +modes, has GNU readline support and `expect' facility, which makes it +useful in automated test cases. + + See the documentation, chapter `mtasim'. + -Version 3.1.91, alpha_3_1_91_berkeley_txn +Version 3.1.91, 2007-04-23 + +* Non-blocking syslog + +This version is shipped with non-blocking syslog implementation by +Simon Kelley. You may wish to enable it if you noticed that the +number of mailfromd processes grows uncontrollably and the processes +are hung for prolonged amounts of time. Usually this indicates that +the daemon blocks in syslog() calls. Read the description of +`--enable-syslog-async' option in chapter `Building' for the detailed +discussion of this (try `info -f doc/mailfromd.info --index-search +syslog-async'). * SPF support @@ -27,7 +51,7 @@ below). For compatibility with the previous versions, its use outside of a loop statement is still allowed, but a warning is issued. You are -enouraged to replace all occurrances of `next' in your confifuration +encouraged to replace all occurrences of `next' in your configuration scripts with `pass'. * Loop @@ -40,6 +64,8 @@ do ... done [while <stmt>] +See the documentation, section `Loop Statements'. + * break and next The `break' statement exits from the enclosing loop. @@ -107,6 +133,9 @@ consists of: The same output can be obtained by calling function stack_trace() in your filter program. +See the documentation, section `Runtime Errors', for the detailed +description and examples. + * connect handler Connect handler is implemented. @@ -197,6 +226,15 @@ track of the included files. If the requested file has already been included, `#include_once' returns silently, while `#include' issues an error message. +* New statement #require + +Requires use of the named module, e.g.: + +#require dns + +See the documentation, section `Modules', for the description of MFL +module system. + * Internet address manipulation functions - number ntohl (number N) @@ -210,7 +248,7 @@ an error message. * DNS functions -DNS functions are reemplemented in two layers: +DNS functions are reimplemented in two layers: 1. Primitive calls: @@ -232,12 +270,20 @@ fails. These are implemented in MFL and work exactly as their predecessors in 3.1.x branch. -To use the traditional calls, include file "dns.mf". +To use the traditional calls, add the following statement at the +beginning of your script file: + + #require dns + +(see the documentatio, section `Modules' for the description of +#require statement) * Function `match_cidr' -This function has been reemplemented in MFL. To use it, include -"match_cidr.mf". +This function has been reimplemented in MFL. To use it, add +`#require match_cidr' at the top of your script source (see the +documentatio, section `Modules' for the description of +#require statement) * Catch arguments @@ -304,7 +350,12 @@ you can write New built-in macro `__statedir__' expands to the name of the default program state directory. - + +* Changing state directory at run-time + +It is possible using `--state-directory' command line option or +`#pragma option state-directory' statement. + * Bugfixes ** Fix incorrect packet length calculation in connect Milter handler. The bug manifested itself with the following log messages: @@ -319,7 +370,7 @@ The bug manifested itself with the following log messages: Milter(mailfrom): to error state ** Fix coredumps on printing void returns with --dump-tree -** Fix coredumps on optimising conditionals like +** Fix coredumps on optimizing conditionals like if 0 do_something @@ -343,7 +394,7 @@ makes function `sa_wrapper' limited for use in `prog eom' only. ** Fix passing of string handler arguments between handlers, as in prog helo - do + do set x $1 done @@ -1,7 +1,12 @@ Mailfromd README -Copyright (C) 2005, 2006 Sergey Poznyakoff +Copyright (C) 2005, 2006, 2007 Sergey Poznyakoff See the end of file for copying conditions. +Dedico aquesta obra a Lluis Llach, un hom qui ha canviat la meva vida. +No puc dedicar-li ni una poesia, ni una cançó, ho sento molt. Ara, +commogut per el seu concert de comiat, li dedico ho que puc: aquest +programa senzill. + * Introduction This file contains brief information about configuring, testing @@ -3,12 +3,14 @@ MODLIST="argp\ fprintftime\ malloc\ memrchr\ + mkdtemp\ obstack\ realloc\ regex\ + save-cwd\ snprintf\ strtok_r" gnulib-tool --import --avoid xalloc-die $MODLIST -ln src/daemon.c lib/ +test -f lib/daemon.c || ln src/daemon.c lib/ autoreconf -i -f -s diff --git a/configure.ac b/configure.ac index 2b19f7cb..cbdf2fdf 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_PREREQ(2.59) m4_define([MF_VERSION_MAJOR], 3) m4_define([MF_VERSION_MINOR], 1) -m4_define([MF_VERSION_PATCH], 91) +m4_define([MF_VERSION_PATCH], 92) AC_INIT([mailfromd], MF_VERSION_MAJOR.MF_VERSION_MINOR[]m4_ifdef([MF_VERSION_PATCH],.MF_VERSION_PATCH), [bug-mailfromd@gnu.org.ua]) @@ -109,6 +109,21 @@ AH_BOTTOM([#ifndef HAVE_ARGCV_UNESCAPE_CHAR #endif ]) +AC_ARG_ENABLE([syslog-async], + AC_HELP_STRING([--enable-syslog-async], + [enable non-blocking version of syslog]), + [case "${enableval}" in + yes) syslog_async=yes ;; + no) syslog_async=no ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-syslog-async]) ;; + esac],[syslog_async=no]) + +if test $syslog_async = "yes"; then + AC_SUBST([BUILD_SYSLOG_ASYNC], 'libsyslog_async.a') + AC_SUBST([SYSLOG_LIBS], './libsyslog_async.a') + AC_DEFINE([USE_SYSLOG_ASYNC], [1], [Define if syslog-async is being used]) +fi + # Check for DBM flavor AH_TEMPLATE(BDB2_CURSOR_LASTARG, [Last argument to the cursor member of Berkeley 2 DB structure]) @@ -493,6 +508,7 @@ Socket.................................... $socket Expiration interval....................... $expire Negative DNS answer expiration interval... $negative_dns_expire Rates expire interval..................... $rates_expire +Syslog implementation..................... $syslog_flavor Readline (for mtasim)..................... $usereadline Documentation rendition type.............. $rendition ******************************************************************* @@ -508,6 +524,11 @@ negative_dns_expire=$DEFAULT_DNS_NEGATIVE_EXPIRE_INTERVAL rates_expire=$DEFAULT_EXPIRE_RATES_INTERVAL usereadline=$usereadline rendition=$RENDITION +if test $syslog_async = "yes"; then + syslog_flavor="non-blocking" +else + syslog_flavor="standard" +fi ]) AC_CONFIG_FILES([Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index a46527d7..9ac968a8 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -21,6 +21,7 @@ mailfromd_TEXINFOS=\ fdl.texi\ gacopyz.texi\ macros.texi\ + mtasim.texi\ rendition.texi\ strftime.texi\ values.texi @@ -67,7 +68,8 @@ check-builtins: check-mflib: @check-docs.sh "library functions" \ - '/^[ \t]*func/s/[ \t]*func[ \t][ \t]*\(.[^ \t(]*\).*/\1/p' \ + '/^[ \t]*func[ \t][ \t]*__/b;\ + /^[ \t]*func/s/[ \t]*func[ \t][ \t]*\(.[^ \t(]*\).*/\1/p' \ 's/@deftypefn {Library Function} *[^ ][^ ]* *\([^ ]*\).*/\1/p' \ $(top_srcdir)/mflib/*.mf -- \ $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) -E - \ @@ -82,7 +84,7 @@ check-exceptions: $(info_TEXINFOS) check-refs: - @sed -e = $(info_TEXINFOS) | \ + @sed -e = $(info_TEXINFOS) $(mailfromd_TEXINFOS) | \ sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\)}.*/$(info_TEXINFOS):\1: \2/gp}' > $@-t; \ if [ -s $@-t ]; then echo "Unresolved cross-references:"; cat $@-t;\ fi diff --git a/doc/gacopyz.texi b/doc/gacopyz.texi index 79745f52..eadb788f 100644 --- a/doc/gacopyz.texi +++ b/doc/gacopyz.texi @@ -36,9 +36,9 @@ new and more flexible API. The old API is supported for compatibility with @command{libmilter}. The library name comes from the song @samp{Rozprawa o robokach} by -Kazimierz Grzeskowiak. The phrase @samp{A to nie je mysa, ino -gacopyz} exactly describes what the library is: @samp{That is no -libmilter, but gacopyz}. +@uref{http://gray.gnu.org.ua/grzeskowiak.html, Kazimierz Grzeskowiak}. +The phrase @samp{A to nie je mysa, ino gacopyz} exactly describes what +the library is: @samp{That is no libmilter, but gacopyz}. Future versions of the documentation will include the detailed API description. diff --git a/doc/macros.texi b/doc/macros.texi index d1d7ec4e..a26ad0ca 100644 --- a/doc/macros.texi +++ b/doc/macros.texi @@ -23,3 +23,9 @@ @end smallexample @end macro +@macro mtasimopt{option,text} +@mtindex \option\, --\option\, @r{@command{mtasim} option, \text\} +@end macro + + + diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index e93bfead..6ba94777 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -8,12 +8,15 @@ @defcodeindex pr @defcodeindex op +@c mt is the same as op, but used for mtasim options. +@defcodeindex mt @defcodeindex kw @defcodeindex fl @syncodeindex fn cp @syncodeindex vr cp @syncodeindex ky cp +@syncodeindex mt cp @syncodeindex pg cp @syncodeindex tp cp @syncodeindex op cp @@ -62,6 +65,15 @@ Software Foundation raise funds for GNU development.'' @end titlepage @page +@quotation +Dedico aquesta obra a Lluis Llach, un home qui ha canviat la meva vida. +No puc dedicar-li ni una poesia, ni una can@,c@'o, ho sento molt. Ara, +commogut pel seu concert de comiat, li dedico ho que puc: aquest programa +senzill. +@end quotation + + +@page @summarycontents @page @contents @@ -81,6 +93,7 @@ documents @command{mailfromd} Version @value{VERSION}. * MFL:: The Mail Filtering Language. * Mailfromd Configuration:: Configuring @command{mailfromd}. * Sendmail Configuration:: Configuring Sendmail to use @command{mailfromd}. +* mtasim:: MTA simulator. * Reporting Bugs:: How to Report a Bug. Appendices @@ -112,6 +125,7 @@ Tutorial * Start Up:: * Simplest Configurations:: * Conditional Execution:: +* Functions and Modules:: * Domain Name System:: * Checking Sender Address:: * SMTP Timeouts:: @@ -124,6 +138,7 @@ Tutorial * Databases:: * Testing Filter Scripts:: * Logging and Debugging:: +* Runtime errors:: Databases @@ -133,25 +148,26 @@ Databases Mail Filtering Language -* Comments:: Usual and pragmatic comments. -* Data Types:: -* Numbers:: -* Literals:: -* Constants:: -* Here Documents:: -* Sendmail Macros:: -* Variables:: -* Built-in macros:: -* Back references:: -* Handlers:: -* Functions:: Functions. -* Expressions:: Expressions. -* Statements:: -* Conditionals:: Conditional Statements. -* Exceptions:: Exceptional Conditions and their Handling. -* Polling:: Sender Verification Tests. -* Filter Script Example:: A Working Filter Script Explained. -* Reserved Words:: A Reference List of Reserved Words. +* Comments:: Usual and pragmatic comments. +* Data Types:: +* Numbers:: +* Literals:: +* Here Documents:: +* Sendmail Macros:: +* Constants:: +* Variables:: +* Back references:: +* Handlers:: +* Functions:: Functions. +* Expressions:: Expressions. +* Statements:: +* Conditionals:: Conditional Statements. +* Loops:: Loop Statements. +* Exceptions:: Exceptional Conditions and their Handling. +* Polling:: Sender Verification Tests. +* Modules:: Modules are Collections of Useful Functions. +* Filter Script Example:: A Working Filter Script Explained. +* Reserved Words:: A Reference List of Reserved Words. Comments @@ -160,6 +176,14 @@ Comments * stacksize:: Pragma stacksize. * regex:: Pragma regex. +Constants + +* Built-in constants:: + +Variables + +* Predefined variables:: + Functions * Built-in:: Built-in and Library Functions @@ -179,6 +203,8 @@ Built-in and Library Functions * Special test functions:: * Mail Sending Functions:: * Debugging Functions:: +* Blacklisting Functions:: +* SPF Functions:: User-Defined Functions @@ -220,6 +246,14 @@ Command Line Options. * Logging and Debugging Options:: * Informational Options:: +@command{mtasim} --- a testing tool + +* interactive mode:: +* expect commands:: +* traces:: +* daemon mode:: +* option summary:: + @end detailmenu @end menu @@ -371,7 +405,7 @@ it depends entirely on how you will instruct it to act in this case, but the general practice is to return temporary failure, which will urge the remote party to retry sending his/her message later. -@cindex caching DNS requests +@cindex caching @acronym{DNS} requests After receiving a definite answer, @command{mailfromd} will cache it in its database, so that next time your @acronym{MTA} receives a message from that address (or from the sender IP/email address pair, @@ -466,9 +500,9 @@ It is available from @uref{http://www.gnu.org/software/mailutils}. @item A @acronym{DBM} library. @anchor{DBM} -@cindex DBM +@cindex @acronym{DBM} @cindex Berkeley DB -@cindex GDBM +@cindex @acronym{GDBM} @command{Mailfromd} is able to link with two flavors of @acronym{DBM} libraries: Berkeley DB or @command{gdbm}. It will refuse to build without @acronym{DBM}. By default, @command{configure} will try to @@ -614,11 +648,12 @@ described in more detail in @ref{Databases}. The default value is 86400 seconds, i.e. 24 hours. It is OK for most sites. If, however, you wish to change it, use @var{DEFAULT_EXPIRE_INTERVAL} environment variable. + @cindex DEFAULT_@/DNS_@/NEGATIVE_@/EXPIRE_@/INTERVAL, @command{configure} variable @cindex DEFAULT_EXPIRE_RATES_INTERVAL, @command{configure} variable There are also two variables that allow to control particular expiration intervals: @code{DEFAULT_DNS_NEGATIVE_EXPIRE_INTERVAL} sets -expiration time for cached negative DNS answers (@pxref{DNS Cache +expiration time for cached negative @acronym{DNS} answers (@pxref{DNS Cache Management} (default 3600 seconds) and @code{DEFAULT_EXPIRE_RATES_INTERVAL} sets default expiration time for mail rate database (@pxref{rate}). @@ -627,6 +662,38 @@ Expiration settings can be changed at run time using @samp{#pragma database} statement in the filter script file (@pxref{database}). +@cindex enable-syslog-async, @option{--enable-syslog-async}, @command{configure} option +@cindex syslog, non-blocking +@item Select @command{syslog} implementation to use. + +@anchor{syslog-async} + @command{Mailfromd} uses @code{syslog} for diagnostics output. The +default @code{syslog} implementation on most systems (most notably, on +GNU/Linux) uses blocking @code{AF_UNIX SOCK_DGRAM} sockets. As a +result, when an application calls @code{syslog()}, and +@command{syslogd} is not responding and the socket buffers get full, +the application will hang. + +@cindex Simon Kelley + In the case of a daemon as @command{mailfromd}, it is more important +that it continue to run, than that it continue to log. For this +purpose, @command{mailfromd} is shipped with a non-blocking +@code{syslog} implementation by Simon Kelley. This implementation, +instead of blocking, buffers log lines in memory. When the buffer log +overflows, some lines are lost, but the daemon continues to run. When +lines are lost, this fact is logged with a message of the form: + +@smallexample + async_syslog overflow: 5 log entries lost +@end smallexample + + To enable non-blocking @command{syslog}, use the +@option{--enable-syslog-async} command line option: + +@smallexample +./configure --enable-syslog-async +@end smallexample + @item Run @command{configure} with all the desired options. For example, the following command: @@ -651,10 +718,12 @@ Mailfromd configured with the following settings: DBM version............................... Berkeley DB v. 3 Default user.............................. mail State directory........................... $(localstatedir)/@/$(PACKAGE) -Socket.................................... unix:$(MAILFROMSTATEDIR)/@/mailfrom +Socket.................................... unix:@//$(DEFAULT_STATE_DIR)/@/mailfrom Expiration interval....................... 86400 Negative DNS answer expiration interval... 3600 Rates expire interval..................... 300 +Syslog implementation..................... blocking +Readline (for mtasim)..................... yes Documentation rendition type.............. PROOF ******************************************************************* @end group @@ |