summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2009-05-05 21:19:33 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2009-05-05 21:44:49 (GMT)
commitd2d21d1e6a06239fa97e50435abcea66b60678ae (patch) (unidiff)
treefc99ddaed8b77da3877a36b1b87e35cbf9455e51
parent2e9e8087eef5452299cfc839b7b4cc23bb2feb6c (diff)
downloadmailfromd-d2d21d1e6a06239fa97e50435abcea66b60678ae.tar.gz
mailfromd-d2d21d1e6a06239fa97e50435abcea66b60678ae.tar.bz2
Minor changes.
* NEWS: Update. * doc/mailfromd.texi: Reorder material. * doc/upgrade.texi: New file. * doc/fdl.texi, doc/gacopyz.texi, doc/strftime.texi: Move sectioning commands to the main source. * etc/mailfromd.rc: Reflect recent changes. * mfd/lex.l: Change semantics of __statedir__ and __preproc__. Introduce __defstatedir__ and __defpreproc__.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--NEWS17
-rw-r--r--doc/Makefile.am1
-rw-r--r--doc/fdl.texi1
-rw-r--r--doc/gacopyz.texi1
-rw-r--r--doc/mailfromd.texi664
-rw-r--r--doc/strftime.texi1
-rw-r--r--doc/upgrade.texi474
-rw-r--r--etc/mailfromd.rc25
-rw-r--r--mfd/lex.l14
9 files changed, 666 insertions, 532 deletions
diff --git a/NEWS b/NEWS
index ba95968..9c83826 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
1Mailfromd NEWS -- history of user-visible changes. 2009-05-04 1Mailfromd NEWS -- history of user-visible changes. 2009-05-06
2Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff 2Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff
3See the end of file for copying conditions. 3See the end of file for copying conditions.
4 4
@@ -145,6 +145,21 @@ In addition to the usual expiration algorithm, the rate records are
145also expired if no mails were received during a time span greater than 145also expired if no mails were received during a time span greater than
146the value of the 2nd argument to the rate (or rateok) function. 146the value of the 2nd argument to the rate (or rateok) function.
147 147
148* The __statedir__ built-in constant.
149
150The __statedir__ built-in constant is now expanded to the current
151value of the program state directory. In prior releases it used to
152expand to the default program state directory. A new built-in
153constant __defstatedir__ is introduced, which expands to the value of
154the default program state directory.
155
156* The __preproc__ built-in constant.
157
158Similarly, the __preproc__ built-in constant, which used to signify
159the default preprocessor command line, now expands to its current
160value. The new constant __defpreproc__ expands to the default
161preprocessor command line.
162
148* Bugfixes 163* Bugfixes
149** Second argument to envfrom and envrcpt 164** Second argument to envfrom and envrcpt
150** write without third argument 165** write without third argument
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8003e82..c10bb0b 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -25,6 +25,7 @@ mailfromd_TEXINFOS=\
25 rendition.texi\ 25 rendition.texi\
26 smap.texi\ 26 smap.texi\
27 strftime.texi\ 27 strftime.texi\
28 upgrade.texi\
28 values.texi 29 values.texi
29 30
30EXTRA_DIST = \ 31EXTRA_DIST = \
diff --git a/doc/fdl.texi b/doc/fdl.texi
index a3c8c6f..7da8738 100644
--- a/doc/fdl.texi
+++ b/doc/fdl.texi
@@ -1,5 +1,4 @@
1@setfilename fdl.info 1@setfilename fdl.info
2@appendix GNU Free Documentation License
3@cindex FDL, GNU Free Documentation License 2@cindex FDL, GNU Free Documentation License
4@center Version 1.2, November 2002 3@center Version 1.2, November 2002
5 4
diff --git a/doc/gacopyz.texi b/doc/gacopyz.texi
index 5eecc6f..7354db6 100644
--- a/doc/gacopyz.texi
+++ b/doc/gacopyz.texi
@@ -4,7 +4,6 @@
4@c any later version published by the Free Software Foundation; with no 4@c any later version published by the Free Software Foundation; with no
5@c Invariant Sections, with the Front-Cover texts being ``Mailfromd Manual'', 5@c Invariant Sections, with the Front-Cover texts being ``Mailfromd Manual'',
6@c and with the Back-Cover Texts at your option. 6@c and with the Back-Cover Texts at your option.
7@appendix Gacopyz
8 7
9@ifhtml 8@ifhtml
10@quotation 9@quotation
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 8276c6f..8ac9d7b 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -87,13 +87,13 @@ Software Foundation raise funds for GNU development.''
87@page 87@page
88@contents 88@contents
89 89
90@node Top, Preface, (dir), (dir) 90@ifnottex
91@node Top
92@top Mailfromd
91 93
92@ifinfo
93@chapter Mailfromd
94This edition of the @cite{Mailfromd Manual}, last updated @value{UPDATED}, 94This edition of the @cite{Mailfromd Manual}, last updated @value{UPDATED},
95documents @command{mailfromd} Version @value{VERSION}. 95documents @command{mailfromd} Version @value{VERSION}.
96@end ifinfo 96@end ifnottex
97 97
98@menu 98@menu
99* Preface:: Short description of this manual; brief 99* Preface:: Short description of this manual; brief
@@ -116,6 +116,7 @@ Appendices
116 116
117* Gacopyz:: 117* Gacopyz::
118* Time and Date Formats:: 118* Time and Date Formats::
119* Upgrading::
119* Copying This Manual:: The GNU Free Documentation License. 120* Copying This Manual:: The GNU Free Documentation License.
120* Concept Index:: Index of Concepts. 121* Concept Index:: Index of Concepts.
121 122
@@ -139,19 +140,6 @@ Sender Address Verification.
139 140
140* Limitations:: 141* Limitations::
141 142
142Building the Package
143
144* 500-510:: Upgrading from 5.0 to 5.1
145* 440-500:: Upgrading from 4.4 to 5.0
146* 43x-440:: Upgrading from 4.3.x to 4.4
147* 420-43x:: Upgrading from 4.2 to 4.3.x
148* 410-420:: Upgrading from 4.1 to 4.2
149* 400-410:: Upgrading from 4.0 to 4.1
150* 31x-400:: Upgrading from 3.1.x to 4.0
151* 30x-31x:: Upgrading from 3.0.x to 3.1
152* 2x-30x:: Upgrading from 2.x to 3.0.x
153* 1x-2x:: Upgrading from 1.x to 2.x
154
155Tutorial 143Tutorial
156 144
157* Start Up:: 145* Start Up::
@@ -359,10 +347,23 @@ Configuration Example
359* Hairy Pies:: 347* Hairy Pies::
360* Inetd Pies:: 348* Inetd Pies::
361 349
350Upgrading
351
352* 500-510:: Upgrading from 5.0 to 5.1
353* 440-500:: Upgrading from 4.4 to 5.0
354* 43x-440:: Upgrading from 4.3.x to 4.4
355* 420-43x:: Upgrading from 4.2 to 4.3.x
356* 410-420:: Upgrading from 4.1 to 4.2
357* 400-410:: Upgrading from 4.0 to 4.1
358* 31x-400:: Upgrading from 3.1.x to 4.0
359* 30x-31x:: Upgrading from 3.0.x to 3.1
360* 2x-30x:: Upgrading from 2.x to 3.0.x
361* 1x-2x:: Upgrading from 1.x to 2.x
362
362@end detailmenu 363@end detailmenu
363@end menu 364@end menu
364 365
365@node Preface, Intro, Top, Top 366@node Preface
366@unnumbered Preface 367@unnumbered Preface
367 368
368 Simple Mail Transfer Protocol (@acronym{SMTP}) which is the standard 369 Simple Mail Transfer Protocol (@acronym{SMTP}) which is the standard
@@ -525,11 +526,12 @@ invested a lot of his time in finding bugs and testing bugfixes.
525@cindex John McEleney 526@cindex John McEleney
526@cindex Ben McKeegan 527@cindex Ben McKeegan
527 John McEleney and Ben McKeegan contributed the token bucket filter 528 John McEleney and Ben McKeegan contributed the token bucket filter
528implementation (@code{tbf_rate} function, @FIXME-pxref{}). 529implementation (@pxref{TBF}).
529 530
530@cindex Con Tassios 531@cindex Con Tassios
531 Con Tassios helped to find and fix various bugs and contributed the 532 Con Tassios helped to find and fix various bugs and contributed the
532new implementation of the @code{greylist} function (@FIXME-pxref{}). 533new implementation of the @code{greylist} function (@pxref{greylisting
534types}).
533 535
534 The following people (in alphabetical order) provided bug reports 536 The following people (in alphabetical order) provided bug reports
535and helpful comments for various versions of the program: 537and helpful comments for various versions of the program:
@@ -543,7 +545,7 @@ and helpful comments for various versions of the program:
543Alan Dobkin, Brent Spencer, Jeff Ballard, Nacho Gonz@'alez L@'opez, 545Alan Dobkin, Brent Spencer, Jeff Ballard, Nacho Gonz@'alez L@'opez,
544Phil Miller, Simon Christian, Thomas Lynch. 546Phil Miller, Simon Christian, Thomas Lynch.
545 547
546@node Intro, Building, Preface, Top 548@node Intro
547@chapter Introduction to @command{mailfromd} 549@chapter Introduction to @command{mailfromd}
548 550
549 @command{Mailfromd} is a general-purpose mail filtering daemon and a 551 @command{Mailfromd} is a general-purpose mail filtering daemon and a
@@ -821,7 +823,7 @@ commands. The framework is explained in detail in @acronym{RFC} 4408
821 Mailfromd provides a set of functions (@pxref{SPF Functions}) for 823 Mailfromd provides a set of functions (@pxref{SPF Functions}) for
822using @acronym{SPF} to control mail flow. 824using @acronym{SPF} to control mail flow.
823 825
824@node Building, Tutorial, Intro, Top 826@node Building
825@chapter Building the Package 827@chapter Building the Package
826 828
827@cindex building @command{mailfromd} 829@cindex building @command{mailfromd}
@@ -1102,441 +1104,15 @@ reconfigure the package with the right options.
1102and mode. 1104and mode.
1103 1105
1104@item Examine filter script file 1106@item Examine filter script file
1105(@file{@var{sysconfdir}/mailfromd.etc}) and edit it, if necessary. If 1107(@file{@var{sysconfdir}/mailfromd.etc}) and edit it, if necessary.
1106you are upgrading from an older version of @command{mailfromd}, see
1107the corresponding section below.
1108@end enumerate
1109
1110@menu
1111* 500-510:: Upgrading from 5.0 to 5.1
1112* 440-500:: Upgrading from 4.4 to 5.0
1113* 43x-440:: Upgrading from 4.3.x to 4.4
1114* 420-43x:: Upgrading from 4.2 to 4.3.x
1115* 410-420:: Upgrading from 4.1 to 4.2
1116* 400-410:: Upgrading from 4.0 to 4.1
1117* 31x-400:: Upgrading from 3.1.x to 4.0
1118* 30x-31x:: Upgrading from 3.0.x to 3.1
1119* 2x-30x:: Upgrading from 2.x to 3.0.x
1120* 1x-2x:: Upgrading from 1.x to 2.x
1121@end menu
1122
1123@node 500-510
1124@section Upgrading from 5.0 to 5.1
1125@cindex Upgrading from 5.0 to 5.1
1126@WRITEME
1127
1128@node 440-500
1129@section Upgrading from 4.4 to 5.0
1130@cindex Upgrading from 4.4 to 5.0
1131
1132 This version of Mailfromd requires
1133@uref{http://www.gnu.org/software/mailutils, GNU mailutils} version
11342.0 or later.
1135
1136 Upgrading from version 4.4 to 5.0 requires no additional
1137changes. The major differences between these two versions are
1138summarized below:
1139
1140@enumerate 1
1141@item Support for @samp{MeTA1}.
1142
1143@item New @samp{Mailutils} configuration file.
1144
1145@item New @acronym{MFL} functions.
1146
1147@enumerate a
1148@item Message functions. @xref{Message functions}.
1149@item Mailbox functions. @xref{Mailbox functions}.
1150@item Mail body functions. @xref{Mail body functions}.
1151@item Header modification functions. @xref{Header modification functions}.
1152@item Envelope modification functions. @xref{Envelope modification functions}.
1153@item Quarantine functions. @xref{Quarantine functions}.
1154@item @code{getopt} and @code{varptr}. @xref{getopt}.
1155@item Macro access functions. @xref{Macro access}.
1156@item Character type functions. @xref{Character Type}.
1157@item New string functions (@pxref{String manipulation}):
1158@code{verp_extract_user}, @code{sa_format_report_header},
1159@code{sa_format_score}.
1160@item Sequential access to DBM files. @xref{dbm-seq}.
1161@end enumerate
1162
1163@item Changes in @acronym{MFL}
1164
1165@enumerate 1
1166@item @xref{variadic functions}.
1167@item @xref{function alias}.
1168@end enumerate
1169
1170@item New operation mode: @xref{Run Mode}.
1171
1172@item Improved stack growth technique.
1173
1174The stack can be grown either by fixed size blocks, or
1175exponentially. Upper limit can be specified. @xref{stacksize}.
1176
1177@item Milter ports can be specified using @acronym{URL} notation.
1178
1179@item Removed deprecated features.
1180
1181Support for some deprecated features has been withdrawn. These are:
1182
1183@enumerate a
1184@item Command line options @option{--ehlo},
1185@option{--postmaster-email}, and @option{--mailfrom}.
1186These became deprecated in version 4.0. @xref{31x-400}.
1187@end enumerate
1188
1189@end enumerate
1190
1191@node 43x-440
1192@section Upgrading from 4.3.x to 4.4
1193@cindex Upgrading from 4.3.x to 4.4
1194
1195 The deprecated @option{--domain} command line option has been
1196withdrawn. The short option @option{-D} now defines a preprocessor
1197symbol (@pxref{Preprocessor Options}).
1198
1199 This version correctly handles name clashes between constants and
1200variables, which remained unnoticed in previous releases.
1201@xref{variable--constant shadowing}, for a detailed description of it.
1202
1203 To minimize chances of name clashes, all symbolic exception codes has
1204been renamed by prefixing them with the @samp{e_}, thus, e.g. @code{divzero}
1205became @code{e_divzero}, etc. The @code{ioerr} exception code is renamed to
1206@code{e_io}. @xref{status.mfh}, for a full list of the new exception codes.
1207
1208@cindex @code{OLD_EXCEPTION_CODES}, preprocessor symbol
1209 For consistency, the following most often used codes are available without
1210the @samp{e_} previx: success, not_found, failure, temp_failure. This
1211makes most existing user scripts suitable for use with version 4.4
1212without any modification. If your script refers to any exception
1213codes other than these four, you can still use it by defining a
1214preprocessor symbol @code{OLD_EXCEPTION_CODES}, for example:
1215
1216@smallexample
1217$ mailfromd -DOLD_EXCEPTION_CODES
1218@end smallexample
1219
1220@node 420-43x
1221@section Upgrading from 4.2 to 4.3.x
1222@cindex Upgrading from 4.2 to 4.3.x
1223@cindex @code{DEFAULT_SYSLOG_ASYNC}, @command{configure} variable
1224
1225 Upgrading from 4.2 to 4.3 or 4.3.1 does not require any changes to
1226your configuration and scripts. The only notable change in these
1227versions is the following:
1228
1229 The asynchronous syslog implementation was reported to malfunction
1230on some systems (notably on Solaris), so this release does not enable
1231it by default. The previous meaning of the @option{--enable-syslog-async}
1232configuration option is also restored. Use this option in order to
1233enable asynchronous syslog feature. To set default syslog
1234implementation, use @code{DEFAULT_SYSLOG_ASYNC} configuration variable
1235(@pxref{syslog-async}).
1236
1237The following deprecated features are removed:
1238
1239@enumerate
1240@item @code{#pragma option ehlo} statement.
1241
1242It became deprecated in version 4.0. @xref{pragma-option-ehlo}.
1243
1244@item @code{#pragma option mailfrom} statement.
1245
1246It became deprecated in version 4.0. @xref{pragma-option-ehlo}.
1247 1108
1248@item The @option{--config-file} command line option. 1109@item Upgrading
1249 1110If you are upgrading from an earlier release of Mailfromd, refer to
1250It became deprecated in version 3.1. @xref{30x-31x}. 1111@ref{Upgrading}, for detailed instructions.
1251
1252@item Built-in exception codes in catch statements.
1253
1254They are deprecated since version 4.0. @xref{31x-400}.
1255@end enumerate
1256 1112
1257@node 410-420
1258@section Upgrading from 4.1 to 4.2
1259@cindex Upgrading from 4.1 to 4.2
1260 Upgrading to this version does not require any special efforts. You
1261can use your configuration files and filter scripts without any
1262changes. The only difference worth noticing is that starting from this
1263version @command{mailfromd} is always compiled with asynchronous
1264syslog implementation. The @option{--enable-syslog-async}
1265configuration file option is still available, but its meaning has
1266changed: it sets the @emph{default} syslog implementation to use
1267(@pxref{syslog-async}). Thus, it can be used the same way it was in
1268previous versions. You can also select the syslog implementation at
1269run time, see @ref{Logging and Debugging, --syslog-async option}, for
1270more detailed information.
1271
1272@node 400-410
1273@section Upgrading from 4.0 to 4.1
1274@cindex Upgrading from 4.0 to 4.1
1275
1276 Upgrading to this version does not require any special efforts. You
1277can use your configuration files and filter scripts without any changes.
1278Notice only the following major differences between 4.1 and 4.0:
1279
1280@itemize @bullet
1281@item Input files are preprocessed before compilation.
1282@xref{Preprocessor}, for more information.
1283
1284@item There is a way to discern between a not-supplied optional
1285parameter, and a supplied one, having null value (@pxref{defined}).
1286
1287@item The version 4.1 implements @code{sprintf} function
1288(@pxref{String formatting}) and @code{printf} macro
1289(@pxref{Preprocessor, printf}).
1290
1291@item Support for some obsolete features is withdrawn. These include:
1292
1293@enumerate 1
1294@item
1295Using @samp{&@var{code}} to specify exception codes
1296@item
1297Pragma options: @code{retry}, @code{io-retry}, and
1298@code{connect-retry}.
1299@end enumerate 1113@end enumerate
1300@end itemize
1301
1302@node 31x-400
1303@section Upgrading from 3.1.x to 4.0
1304@cindex upgrading from 3.1.x to 4.0
1305
1306 Before building this version, please re-read the chapter
1307@xref{Building}, especially the section @ref{syslog-async, Using
1308non-blocking syslog}.
1309
1310 Starting from the version 4.0, @acronym{MFL} no longer uses the
1311predefined symbolic names for exception codes (previous versions used
1312the @samp{&} prefix to dereference them). Instead, it relies on
1313constants defined in the include file @file{status.mfh}
1314(@pxref{status.mfh}).
1315
1316 However, the script files from 3.1 series will still work, but
1317the following warning messages will be displayed:
1318
1319@smallexample
1320Warning: obsolete constant form used: &failure
1321Warning: remove leading '&' and include <status.mfh>
1322
1323Warning: Using built-in exception codes is deprecated
1324Warning: Please include <status.mfh>
1325@end smallexample
1326
1327@anchor{pragma-option-ehlo}
1328 Another important difference is that pragmatic options @samp{ehlo}
1329and @samp{mailfromd} are now deprecated, as well as their command line
1330equivalents @option{--ehlo} and @option{--domain}. These options
1331became superfluous after the introduction of @code{mailfrom_address}
1332and @code{ehlo_domain} built-in variables. For compatibility with the
1333previous versions, they are still supported by @command{mailfromd}
13344.0, but a warning message is issued if they are used:
1335
1336@smallexample
1337@group
1338warning: `#pragma option ehlo' is deprecated,
1339 consider using `set ehlo_domain "domain.name"' instead
1340@end group
1341@end smallexample
1342
1343 To update your startup scripts for the new version follow these
1344steps:
1345
1346@enumerate 1
1347@item
1348 Change @code{#pragma option mailfrom @var{value}} to
1349@code{set mailfrom_address @var{value}}. Refer to
1350@ref{mailfrom_address}, for a detailed discussion of this variable.
1351
1352@item
1353 Change @code{#pragma option ehlo @var{value}} to
1354@code{set ehlo_domain @var{value}}. Refer to
1355@ref{ehlo_domain}, for a detailed discussion of this variable.
1356 1114
1357@item 1115@node Tutorial
1358 Include @file{status.mfh}. Add the following line to the top of
1359your startup file:
1360
1361@smallexample
1362#include_once <status.mfh>
1363@end smallexample
1364
1365@item
1366 Remove all instances of @samp{&} in front of the constants. You can
1367use the following @command{sed} expression: @samp{s/&\([a-z]\)/\1/g}.
1368
1369@item
1370 If your code uses any of the following functions: @code{hostname},
1371@code{resolve}, @code{hasmx} or @code{ismx}, add the following line
1372to the top of your script:
1373
1374@smallexample
1375#require dns
1376@end smallexample
1377
1378@xref{Modules}, for a detailed description of the module system.
1379
1380@item
1381 Replace all occurrences of @code{next} with @code{pass}.
1382
1383@item
1384 If your code uses function @code{match_cidr}, add the following line
1385to the top of your script:
1386
1387@smallexample
1388#require match_cidr
1389@end smallexample
1390
1391@xref{Modules}, for a description of @acronym{MFL} module system.
1392
1393@end enumerate
1394
1395@node 30x-31x
1396@section Upgrading from 3.0.x to 3.1
1397@cindex upgrading from 3.0.x to 3.1
1398
1399@enumerate 1
1400@item
1401 The @command{mailfromd} binary no longer supports
1402@option{--config-file} (@option{-c}) option. To use an alternative
1403script file, give it as an argument, i.e. instead of:
1404
1405@smallexample
1406$ @kbd{mailfromd --config-file @var{file.rc}}
1407@end smallexample
1408
1409@noindent
1410write:
1411@smallexample
1412$ @kbd{mailfromd @var{file.rc}}
1413@end smallexample
1414
1415 For backward compatibility, the old style invocation still works but
1416produces a warning message. However, if @command{mailfromd}
1417encounters the @option{-c} option it will print a diagnostic message
1418and exit immediately. This is because the semantics of this option
1419will change in the future releases.
1420
1421@item
1422 If a variable is declared implicitly within a function, it is
1423created as automatic. This differs from the previous versions, where
1424all variables were global. It is a common practice to use global
1425variables to pass additional information between handlers (@xref{HELO
1426Domain}, for an example of this approach). If your filter uses it,
1427make sure the variable is declared as global. For example, this code:
1428
1429@float Figure, old-code
1430@caption{Implicit declaration, old style}
1431@smallexample
1432prog helo
1433do
1434 # @r{Save the host name for further use}
1435 set helohost $s
1436done
1437@end smallexample
1438@end float
1439
1440@noindent
1441has to be rewritten as follows:
1442
1443@float Figure, new-code
1444@caption{Implicit declaration, new style}
1445@smallexample
1446set helohost ""
1447
1448prog helo
1449do
1450 # @r{Save the host name for further use}
1451 set helohost $s
1452done
1453@end smallexample
1454@end float
1455
1456@item
1457 Starting from version 3.1 the function @code{dbmap} takes an
1458optional third argument indicating whether or not to count the
1459terminating null character in key (@pxref{dbmap}). If your startup
1460script contained any calls to @code{dbmap}, change them as follows:
1461
1462@multitable @columnfractions 0.5 0.5
1463@headitem in 3.0.x @tab in 3.1
1464@item dbmap(@var{db}, @var{key}) @tab dbmap(@var{db}, @var{key}, 1)
1465@end multitable
1466
1467@end enumerate
1468
1469
1470@node 2x-30x
1471@section Upgrading from 2.x to 3.0.x
1472@cindex upgrading from 2.x to 3.0.x
1473 Update your startup scripts and/or crontab entries. The
1474@command{mailfromd} binary is now installed in @file{$@{prefix@}/sbin}.
1475
1476 We also encourage you to update the startup script (run
1477@kbd{cp etc/rc.mailfromd /wherever-your-startup-lives}), since the new
1478version contains lots of enhancements.
1479
1480@node 1x-2x
1481@section Upgrading from 1.x to 2.x
1482@cindex upgrading from 1.x to 2.x
1483 If you are upgrading from version 1.x to 2.0, you will have to do
1484the following:
1485
1486@enumerate 1
1487@item
1488Edit your script file and enclose the entire code section into:
1489
1490@smallexample
1491@group
1492prog envfrom
1493do
1494 @dots{}
1495done
1496@end group
1497@end smallexample
1498
1499@noindent
1500@xref{Handlers}, for more information about the @code{prog} statement.
1501
1502@item
1503If your code contained any @code{rate} statements, convert them to
1504function calls (@pxref{Rate limiting functions, rate}), using the
1505following scheme:
1506
1507@smallexample
1508@group
1509Old statement: if rate @var{key} @var{limit} / @var{expr}
1510New statement: if rate(@var{key}, interval("@var{expr}")) > @var{limit}
1511@end group
1512@end smallexample
1513
1514For example,
1515@smallexample
1516 rate $f 180 / 1 hour 25 minutes
1517@end smallexample
1518@noindent
1519should become
1520@smallexample
1521 rate($f, interval("1 hour 25 minutes")) > 180
1522@end smallexample
1523
1524@item
1525Rebuild your databases using the following command:
1526
1527@smallexample
1528mailfromd --compact --all
1529@end smallexample
1530
1531@noindent
1532This is necessary since the format of @command{mailfromd} databases
1533has changed in version 2.0: the key field now includes the trailing
1534@samp{NUL} character, which is also reflected in its length. This
1535allows for empty (zero-length) keys. @xref{Database Maintenance}, for
1536more information about the database compaction.
1537@end enumerate
1538
1539@node Tutorial, MFL, Building, Top
1540@chapter Tutorial 1116@chapter Tutorial
1541 1117
1542 This chapter contains a tutorial introduction, guiding you 1118 This chapter contains a tutorial introduction, guiding you
@@ -1546,9 +1122,10 @@ most complicated details, concentrating mainly on the
1546common practical tasks. 1122common practical tasks.
1547 1123
1548 If you are familiar to @command{mailfromd}, you can skip this 1124 If you are familiar to @command{mailfromd}, you can skip this
1549chapter and go directly to the next one, that contains detailed 1125chapter and go directly to the next one (@pxref{Mail Filtering
1550discussion of the configuration language and @command{mailfromd} 1126Language}), which contains detailed discussion of the mail filtering
1551interaction with the Mail Transport Agent. 1127language and @command{mailfromd} interaction with the Mail Transport
1128Agent.
1552 1129
1553@menu 1130@menu
1554* Start Up:: 1131* Start Up::
@@ -2797,28 +2374,30 @@ Authorization and Authentication Principles, mailutils, GNU Mailutils
2797Manual}). Here we will give only some practical advices for 2374Manual}). Here we will give only some practical advices for
2798implementing it in @command{mailfromd} filters. 2375implementing it in @command{mailfromd} filters.
2799 2376
2800 The actual list of authorization module available depends on your 2377 The actual list of available authorization modules depends on your
2801@command{mailutils} installation. Usually it includes, apart from 2378@command{mailutils} installation. Usually it includes, apart from
2802traditional @acronym{UNIX} @file{passwd} database, the functions for verifying 2379traditional @acronym{UNIX} @file{passwd} database, the functions for verifying
2803@acronym{PAM}, @acronym{RADIUS} and @acronym{SQL} database accounts. 2380@acronym{PAM}, @acronym{RADIUS} and @acronym{SQL} database accounts.
2804Each of the authorization 2381Each of the authorization methods is configured using special
2805methods is configured using special command line options. Run 2382configuration file statements. For the description of the Mailutils
2806@command{mailfromd --help} and you will get the listing of those under 2383configuration files, @xref{configuration, Mailutils Configuration
2807@samp{Authentication options} section. For the exact meaning of each 2384File, Mailutils Configuration File, mailutils, GNU Mailutils Manual}.
2808particular option, refer to @ref{auth, auth, Authentication and 2385You can obtain the template for @command{mailfromd} configuration by
2809Authorization Options, mailutils, GNU Mailutils Manual}. It is often 2386running @command{mailfromd --config-help}.
2810inconvenient to specify all required options in the command line, so you are 2387
2811advised to use @dfn{mailutils system configuration file}. 2388 For example, the following @file{mailutils.rc} file:
2812@xref{configuration, Mailutils Configuration File, Mailutils
2813Configuration File, mailutils, GNU Mailutils Manual}, for its
2814description. Its use boils down to placing in it all
2815the necessary authorization options, prefixed by the label
2816@code{:mailfromd}. For example, the following @file{mailutils.rc} statement:
2817 2389
2818@smallexample 2390@smallexample
2819@group 2391@group
2820:mailfromd --authorization=pam:system \ 2392program mailfromd @{
2821 --pam-service=mailfromd 2393 auth @{
2394 authorization pam:system;
2395 @}
2396
2397 pam @{
2398 service mailfromd;
2399 @}
2400@}
2822@end group 2401@end group
2823@end smallexample 2402@end smallexample
2824 2403
@@ -2862,7 +2441,7 @@ time after which a record is considered expired.
2862@xopindex{show-defaults, introduced} 2441@xopindex{show-defaults, introduced}
2863 To obtain the list of available databases along with their 2442 To obtain the list of available databases along with their
2864preconfigured settings, run @kbd{mailfromd --show-defaults}. You will 2443preconfigured settings, run @kbd{mailfromd --show-defaults}. You will
2865see a similar output: 2444see an output similar to this:
2866 2445
2867@smallexample 2446@smallexample
2868@group 2447@group
@@ -4167,7 +3746,7 @@ resolution of such name clashes is described in detail in
4167Future versions of the program will provide a non-ambiguous way of 3746Future versions of the program will provide a non-ambiguous way of
4168referring to variables and constants from literal strings. 3747referring to variables and constants from literal strings.
4169 3748
4170@node MFL, Using MFL Mode, Tutorial, Top 3749@node MFL
4171@chapter Mail Filtering Language 3750@chapter Mail Filtering Language
4172@cindex MFL 3751@cindex MFL
4173@cindex mail filtering language 3752@cindex mail filtering language
@@ -5354,28 +4933,40 @@ For alpha versions and maintenance releases expands to the version
5354patch level. For stable versions, expands to @samp{0}. 4933patch level. For stable versions, expands to @samp{0}.
5355@end deftypevr 4934@end deftypevr
5356 4935
5357@deftypevr {Built-in constant} string __preproc__ 4936@deftypevr {Built-in constant} string __defpreproc__
5358 Expands to the external preprocessor command line, if the 4937 Expands to the default external preprocessor command line, if the
5359preprocessor is used, or to an empty string if it cannot, e.g.: 4938preprocessor is used, or to an empty string if it is not, e.g.:
5360 4939
5361@smallexample 4940@smallexample
5362__preproc__ @result{} "/usr/bin/m4 -s" 4941__defpreproc__ @result{} "/usr/bin/m4 -s"
5363@end smallexample 4942@end smallexample
5364 4943
5365 @xref{Preprocessor}, for information on preprocessor and its 4944 @xref{Preprocessor}, for information on preprocessor and its
5366features. 4945features.
5367@end deftypevr 4946@end deftypevr
5368 4947
4948@deftypevr {Built-in constant} string __preproc__
4949 Expands to the current external preprocessor command line, if the
4950preprocessor is used, or to an empty string if it is not. Notice,
4951that it equals @code{__defpreproc__}, unless the preprocessor was
4952redefined using @option{--preprocessor} command line option
4953(@pxref{Preprocessor, --preprocessor}).
4954@end deftypevr
4955
5369@deftypevr {Built-in constant} string __version__ 4956@deftypevr {Built-in constant} string __version__
5370Expands to the textual representation of the program version 4957Expands to the textual representation of the program version
5371(e.g. @samp{3.0.90}) 4958(e.g. @samp{3.0.90})
5372@end deftypevr 4959@end deftypevr
5373 4960
5374@deftypevr {Built-in constant} string __statedir__ 4961@deftypevr {Built-in constant} string __defstatedir__
5375Expands to the default state directory (@pxref{statedir}). 4962Expands to the default state directory (@pxref{statedir}).
5376@FIXME{Should have a way to determine the current value of statedir, 4963@end deftypevr
5377as set by state-directory pragma, or, better yet, have a variable 4964
5378reflecting it (r/w).} 4965@deftypevr {Built-in constant} string __statedir__
4966Expands to the current value of the program state directory
4967(@pxref{statedir}). Notice, that it is the same as
4968@code{__defstatedir__} unless the state directory was redefined at run
4969time.
5379@end deftypevr 4970@end deftypevr
5380 4971
5381 Built-in constants can be used as variables, this allows to expand them 4972 Built-in constants can be used as variables, this allows to expand them
@@ -6210,9 +5801,8 @@ invocation syntax is the same for both groups.
6210 @command{Mailfromd} is shipped with a rich set of @dfn{library 5801 @command{Mailfromd} is shipped with a rich set of @dfn{library
6211functions}. In addition to these you can define your own functions. 5802functions}. In addition to these you can define your own functions.
6212 5803
6213 @FIXME{In subsequent sections we will discuss the library and built-in 5804 In subsequent sections we will discuss the library and built-in
6214functions first, and then we will explain how to write your 5805functions, and then we will explain how to write new functions.
6215functions}.
6216 5806
6217@menu 5807@menu
6218* Built-in:: Built-in and Library Functions 5808* Built-in:: Built-in and Library Functions
@@ -6807,7 +6397,18 @@ done
6807 6397
6808@node Header modification functions 6398@node Header modification functions
6809@subsubsection Header Modification Functions 6399@subsubsection Header Modification Functions
6810@UNREVISED{} 6400@cindex header modification
6401
6402 There are two ways to modify message headers in a @acronym{MFL}
6403script. First is to use header actions, described in @ref{Actions},
6404and the second way is to use message modification functions. Compared
6405with the actions, the functions offer a series of advantages. For
6406example, using functions you can construct the name of the header to
6407operate upon (e.g. by concatenating several arguments), something
6408which is impossible when using actions. Moreover, apart from three
6409basic operations (add, modify and remove), as supported by header
6410actions, header functions allow to insert a new header into a
6411particular place.
6811 6412
6812@deftypefn {Built-in Function} void header_add (string @var{name}, @ 6413@deftypefn {Built-in Function} void header_add (string @var{name}, @
6813 string @var{value} [, number @var{idx}]) 6414 string @var{value} [, number @var{idx}])
@@ -6832,7 +6433,7 @@ i.e. it inserts a header @samp{@var{name}: @samp{value}} at
6832@deftypefn {Built-in Function} void header_delete (string @var{name} @ 6433@deftypefn {Built-in Function} void header_delete (string @var{name} @
6833 [, number @var{index}]) 6434 [, number @var{index}])
6834Delete header @var{name} from the envelope. If @var{index} is given, 6435Delete header @var{name} from the envelope. If @var{index} is given,
6835delete @var{index}th instance of header @var{name}. 6436delete @var{index}th instance of the header @var{name}.
6836 6437
6837Notice the differences between this function and the @code{delete} 6438Notice the differences between this function and the @code{delete}
6838action: 6439action:
@@ -6984,7 +6585,7 @@ functions}, for a description of functions for accessing messages.
6984 6585
6985@node Mailbox functions 6586@node Mailbox functions
6986@subsubsection Mailbox Functions 6587@subsubsection Mailbox Functions
6987@UNREVISED{} 6588@cindex mailbox functions
6988 A set of functions is provided for accessing mailboxes and messages 6589 A set of functions is provided for accessing mailboxes and messages
6989within them. In this subsection we describe the functions for 6590within them. In this subsection we describe the functions for
6990accessing mailboxes. 6591accessing mailboxes.
@@ -7048,18 +6649,38 @@ descriptior @var{nsmg} must be obtained from a previous call to
7048 6649
7049@node Message functions 6650@node Message functions
7050@subsubsection Message Functions 6651@subsubsection Message Functions
7051@UNREVISED{} 6652@cindex message functions
7052 6653 The functions described below retrieve information from RFC822
6654messages. The message to operate upon is identified by its
6655@dfn{descriptor}, an integer number returned by the previous call to
6656@code{mailbox_get_message} (@pxref{Mailbox functions,
6657mailbox_get_message}) or @code{current_message}
6658(@pxref{current_message}) function.
6659
7053@deftypefn {Built-in Function} number message_size (number @var{nmsg}) 6660@deftypefn {Built-in Function} number message_size (number @var{nmsg})
7054Return the size of the message @var{nmsg}, in bytes. 6661Return the size of the message @var{nmsg}, in bytes. @emph{Notice},
6662that if @var{nmsg} refers to current message
6663(@pxref{current_message}), the returned value is less than the size
6664seen by the @acronym{MTA}, because @command{mailfromd} recodes
6665@acronym{CR-LF} sequences to @acronym{LF}, i.e. removes carriage
6666returns (@acronym{ASCII} 13) ocurring before line feeds
6667(@acronym{ASCII} 10. To obtain actual message length as seen by the
6668@acronym{MTA}, add the number of lines in the message:
6669
6670@smallexample
6671 set actual_length message_size(%nmsg) + message_lines(%nmsg)
6672@end smallexample
6673
7055@end deftypefn 6674@end deftypefn
7056 6675
7057@deftypefn {Built-in Function} number message_body_size (number @var{nmsg}) 6676@deftypefn {Built-in Function} number message_body_size (number @var{nmsg})
7058Return the size, in bytes, of the body of message @var{nmsg}. 6677Return the size, in bytes, of the body of message @var{nmsg}. See the
6678note to the @code{message_size}, above.
7059@end deftypefn 6679@end deftypefn
7060 6680
7061@deftypefn {Built-in Function} number message_header_size (number @var{nmsg}) 6681@deftypefn {Built-in Function} number message_header_size (number @var{nmsg})
7062Return the size, in bytes of the headers of message @var{nmsg}. 6682Return the size, in bytes of the headers of message @var{nmsg}. See the
6683note to the @code{message_size}, above.
7063@end deftypefn 6684@end deftypefn
7064 6685
7065@deftypefn {Built-in Function} number message_body_lines (number @var{nmsg}) 6686@deftypefn {Built-in Function} number message_body_lines (number @var{nmsg})
@@ -7098,8 +6719,9 @@ If no matching header is not found, the @code{not_found} exception is
7098raised. If another error occures, the @code{failure} exception is 6719raised. If another error occures, the @code{failure} exception is
7099raised. 6720raised.
7100 6721
7101The returned string is a verbatim copy of the message contents. You 6722The returned string is a verbatim copy of the message contents (except
7102might need to apply the @code{unfold} function to it (@pxref{Mail 6723for eventual @acronym{CR-LF} -> @acronym{LF} translation, see above).
6724You might need to apply the @code{unfold} function to it (@pxref{Mail
7103header functions, unfold}). 6725header functions, unfold}).
7104@end deftypefn 6726@end deftypefn
7105 6727
@@ -7146,8 +6768,8 @@ Read and return next line from the body of message @var{nmsg}. If
7146there are no more lines to read, raise the @code{not_found} exception. 6768there are no more lines to read, raise the @code{not_found} exception.
7147@FIXME{Probably a special exception type is needed for that.} 6769@FIXME{Probably a special exception type is needed for that.}
7148 6770
7149Use @code{message_body_rewind} to rewind the body stream and read its 6771Use @code{message_body_rewind} (see above) to rewind the body stream
7150contents again. 6772and read its contents again.
7151@end deftypefn 6773@end deftypefn
7152 6774
7153@deftypefn {Built-in Function} string message_read_line (number @var{nmsg}) 6775@deftypefn {Built-in Function} string message_read_line (number @var{nmsg})
@@ -7786,12 +7408,15 @@ database error occurs while attempting to retrieve the record,
7786@end deftypefn 7408@end deftypefn
7787 7409
7788@deftypefn {Built-in Function} void dbput (string @var{db}, @ 7410@deftypefn {Built-in Function} void dbput (string @var{db}, @
7789 string @var{key}, string @var{value} [, number @var{null}]) 7411 string @var{key}, string @var{value} [, @
7412 number @var{null}, number @var{mode} ])
7790 Inserts in the database a record with the given @var{key} and 7413 Inserts in the database a record with the given @var{key} and
7791@var{value}. If a record with the given @var{key} already exists, its 7414@var{value}. If a record with the given @var{key} already exists, its
7792value is replaced with the supplied one. 7415value is replaced with the supplied one.
7793 7416
7794 See above for the meaning of @var{null}. 7417 See above for the meaning of @var{null}. Optional @var{mode} allows
7418to explicitly specify the file mode for this database. See also
7419@code{#pragma dbprop}, described above.
7795@end deftypefn 7420@end deftypefn
7796 7421
7797@deftypefn {Library Function} void safedbput (string @var{db}, @ 7422@deftypefn {Library Function} void safedbput (string @var{db}, @
@@ -7809,15 +7434,20 @@ the function returns without reporting an error.
7809 7434
7810@noindent 7435@noindent
7811@xref{Modules}, for a description of @acronym{MFL} module system. 7436@xref{Modules}, for a description of @acronym{MFL} module system.
7437@FIXME{safedbput should probably take an optional mode argument, as
7438dbput does.}
7812@end deftypefn 7439@end deftypefn
7813 7440
7814@deftypefn {Built-in Function} void dbdel (string @var{db}, @ 7441@deftypefn {Built-in Function} void dbdel (string @var{db}, @
7815 string @var{key} [, number @var{null}]) 7442 string @var{key} [, number @var{null}, number @var{mode}])
7816 Delete from the database the record with the given @var{key}. If 7443 Delete from the database the record with the given @var{key}. If
7817there are no such record, return without signalling error. 7444there are no such record, return without signalling error.
7818 7445
7819 If the optional @var{null} argument is given and is not zero, the 7446 If the optional @var{null} argument is given and is not zero, the
7820terminating null character will be included in @var{key} length. 7447terminating null character will be included in @var{key} length.
7448
7449 Optional @var{mode} allows to explicitly specify the file mode for
7450this database. See also @code{#pragma dbprop}, described above.
7821@end deftypefn 7451@end deftypefn
7822 7452
7823@anchor{dbm-seq} 7453@anchor{dbm-seq}
@@ -11999,7 +11629,7 @@ The following keywords are preprocessor macros:
11999Any keyword beginning with a @samp{m4_} prefix is a reserved 11629Any keyword beginning with a @samp{m4_} prefix is a reserved
12000preprocessor symbol. 11630preprocessor symbol.
12001 11631
12002@node Using MFL Mode, Mailfromd Configuration, MFL, Top 11632@node Using MFL Mode
12003@chapter Using the GNU Emacs MFL Mode 11633@chapter Using the GNU Emacs MFL Mode
12004@cindex Emacs, @acronym{MFL} mode 11634@cindex Emacs, @acronym{MFL} mode
12005@cindex GNU Emacs, @acronym{MFL} mode 11635@cindex GNU Emacs, @acronym{MFL} mode
@@ -12216,7 +11846,7 @@ loop for set n 0
12216@end smallexample 11846@end smallexample
12217@end defvr 11847@end defvr
12218 11848
12219@node Mailfromd Configuration, Sendmail, Using MFL Mode, Top 11849@node Mailfromd Configuration
12220@chapter Configuring @command{mailfromd} 11850@chapter Configuring @command{mailfromd}
12221 11851
12222 In the simplest case you will be able to startup 11852 In the simplest case you will be able to startup
@@ -12979,7 +12609,7 @@ is called during the system startup and shut down. The exact
12979instructions on how to do so depend on the operating system you use 12609instructions on how to do so depend on the operating system you use
12980and are beyond the scope of this manual. 12610and are beyond the scope of this manual.
12981 12611
12982@node Sendmail, MeTA1, Mailfromd Configuration, Top 12612@node Sendmail
12983@chapter Using @command{mailfromd} with Sendmail. 12613@chapter Using @command{mailfromd} with Sendmail.
12984 12614
12985 This chapter assumes you are familiar with Sendmail configuration in 12615 This chapter assumes you are familiar with Sendmail configuration in
@@ -13103,27 +12733,27 @@ f, @{client_addr@}
13103@end group 12733@end group
13104@end smallexample 12734@end smallexample
13105 12735
13106@node MeTA1, mtasim, Sendmail, Top 12736@node MeTA1
13107@chapter Using @command{mailfromd} with MeTA1. 12737@chapter Using @command{mailfromd} with MeTA1.
13108@WRITEME{} 12738@WRITEME{}
13109 12739
13110@node mtasim, smap, MeTA1, Top 12740@node mtasim
13111@chapter @command{mtasim} --- a testing tool 12741@chapter @command{mtasim} --- a testing tool
13112@include mtasim.texi 12742@include mtasim.texi
13113 12743
13114@node smap, pmult, mtasim, Top 12744@node smap
13115@chapter A universal socket-map program for MeTA1. 12745@chapter A universal socket-map program for MeTA1.
13116@include smap.texi 12746@include smap.texi
13117 12747
13118@node pmult, pies, smap, Top 12748@node pmult
13119@chapter Pmilter multiplexer program. 12749@chapter Pmilter multiplexer program.
13120@include pmult.texi 12750@include pmult.texi
13121 12751
13122@node pies, Reporting Bugs, pmult, Top 12752@node pies
13123@chapter Pies -- a program execution supervisor. 12753@chapter Pies -- a program execution supervisor.
13124@include pies.texi 12754@include pies.texi
13125 12755
13126@node Reporting Bugs, Gacopyz, pies, Top 12756@node Reporting Bugs
13127@chapter How to Report a Bug 12757@chapter How to Report a Bug
13128 12758
13129@quotation 12759@quotation
@@ -13158,17 +12788,23 @@ line options used).
13158@item Conditions under which the bug appears. 12788@item Conditions under which the bug appears.
13159@end itemize 12789@end itemize
13160 12790
13161@node Gacopyz, Time and Date Formats, Reporting Bugs, Top 12791@node Gacopyz
12792@appendix Gacopyz
13162@include gacopyz.texi 12793@include gacopyz.texi
13163 12794
13164@node Time and Date Formats, Copying This Manual, Gacopyz, Top 12795@node Time and Date Formats
12796@appendix Time and Date Formats
13165@include strftime.texi 12797@include strftime.texi
13166 12798
13167@node Copying This Manual, Concept Index, Time and Date Formats, Top 12799@node Upgrading
12800@appendix Upgrading
12801@include upgrade.texi
12802
12803@node Copying This Manual
12804@appendix GNU Free Documentation License
13168@include fdl.texi 12805@include fdl.texi
13169 12806
13170@node Concept Index, , Copying This Manual, Top 12807@node Concept Index
13171@comment node-name, next, previous, up
13172@unnumbered Concept Index 12808@unnumbered Concept Index
13173 12809
13174This is a general index of all issues discussed in this manual 12810This is a general index of all issues discussed in this manual
diff --git a/doc/strftime.texi b/doc/strftime.texi
index 4e504dc..bfed61d 100644
--- a/doc/strftime.texi
+++ b/doc/strftime.texi
@@ -3,7 +3,6 @@
3@c This file is distributed under GFDL 1.1 or any later version 3@c This file is distributed under GFDL 1.1 or any later version
4@c published by the Free Software Foundation. 4@c published by the Free Software Foundation.
5 5
6@appendix Time and Date Formats
7 6
8@cindex time formats, for @option{--time-format} option 7@cindex time formats, for @option{--time-format} option
9 This appendix documents the time format specifications understood by 8 This appendix documents the time format specifications understood by
diff --git a/doc/upgrade.texi b/doc/upgrade.texi
new file mode 100644
index 0000000..4366349
--- a/dev/null
+++ b/doc/upgrade.texi
@@ -0,0 +1,474 @@
1@c Copyright (C) 2005, 2006, 2009 Sergey Poznyakoff
2@c Permission is granted to copy, distribute and/or modify this document
3@c under the terms of the GNU Free Documentation License, Version 1.2 or
4@c any later version published by the Free Software Foundation; with no
5@c Invariant Sections, with the Front-Cover texts being ``Mailfromd Manual'',
6@c and with the Back-Cover Texts at your option.
7
8
9The following sections describe procedures for upgrading
10between the consequtive Mailfromd releases.
11
12@menu
13* 500-510:: Upgrading from 5.0 to 5.1
14* 440-500:: Upgrading from 4.4 to 5.0
15* 43x-440:: Upgrading from 4.3.x to 4.4
16* 420-43x:: Upgrading from 4.2 to 4.3.x
17* 410-420:: Upgrading from 4.1 to 4.2
18* 400-410:: Upgrading from 4.0 to 4.1
19* 31x-400:: Upgrading from 3.1.x to 4.0
20* 30x-31x:: Upgrading from 3.0.x to 3.1
21* 2x-30x:: Upgrading from 2.x to 3.0.x
22* 1x-2x:: Upgrading from 1.x to 2.x
23@end menu
24
25@node 500-510
26@appendixsec Upgrading from 5.0 to 5.1
27@cindex Upgrading from 5.0 to 5.1
28
29 Upgrading from 5.0 to 5.1 does not require any changes in your
30filter scripts. Notice, however, the following important points:
31
32@itemize @bullet
33@item The semantics of @code{__preproc__} and @code{__statedir__}
34built-in constant is slightly different from what it used to be in
355.0. These constants now refer to the @emph{current} values of the
36preprocessor command line and program state directory,
37correspondingly. This should not affect your script, unless you
38redefine the default values on run time. If your script needs to
39access default values, use @code{__defpreproc__} and
40@code{__defstatedir__}, correspondingly (@pxref{Built-in constants}).
41The following example explains the difference between these:
42
43@smallexample
44$ cat pval.mf
45prog envfrom
46do
47 echo "Default value: " __defstatedir__
48 echo "Current value: " __statedir__
49done
50$ mailfromd --state-directory=/var/mfd --test pval.mf
51Default value: /usr/local/var/mailfromd
52Current value: /var/mfd
53@end smallexample
54
55@item If your filter uses the @code{rate} function,
56you might consider using the new function @code{rateok} or
57@code{tbf_rate} instead. For a detailed discussion of these functions,
58see @ref{Sending Rate}.
59
60@item If your script extensively uses database access functions, you
61might be interested in the new @code{#pragma dbprop} (@pxref{dbprop}).
62@end itemize
63
64@node 440-500
65@appendixsec Upgrading from 4.4 to 5.0
66@cindex Upgrading from 4.4 to 5.0
67
68 This version of Mailfromd requires
69@uref{http://www.gnu.org/software/mailutils, GNU mailutils} version
702.0 or later.
71
72 Upgrading from version 4.4 to 5.0 requires no additional
73changes. The major differences between these two versions are
74summarized below:
75
76@enumerate 1
77@item Support for @samp{MeTA1}.
78
79@item New @samp{Mailutils} configuration file.
80
81@item New @acronym{MFL} functions.
82
83@enumerate a
84@item Message functions. @xref{Message functions}.
85@item Mailbox functions. @xref{Mailbox functions}.
86@item Mail body functions. @xref{Mail body functions}.
87@item Header modification functions. @xref{Header modification functions}.
88@item Envelope modification functions. @xref{Envelope modification functions}.
89@item Quarantine functions. @xref{Quarantine functions}.
90@item @code{getopt} and @code{varptr}. @xref{getopt}.
91@item Macro access functions. @xref{Macro access}.
92@item Character type functions. @xref{Character Type}.
93@item New string functions (@pxref{String manipulation}):
94@code{verp_extract_user}, @code{sa_format_report_header},
95@code{sa_format_score}.
96@item Sequential access to DBM files. @xref{dbm-seq}.
97@end enumerate
98
99@item Changes in @acronym{MFL}
100
101@enumerate 1
102@item @xref{variadic functions}.
103@item @xref{function alias}.
104@end enumerate
105
106@item New operation mode: @xref{Run Mode}.
107
108@item Improved stack growth technique.
109
110The stack can be grown either by fixed size blocks, or
111exponentially. Upper limit can be specified. @xref{stacksize}.
112
113@item Milter ports can be specified using @acronym{URL} notation.
114
115@item Removed deprecated features.
116
117Support for some deprecated features has been withdrawn. These are:
118
119@enumerate a
120@item Command line options @option{--ehlo},
121@option{--postmaster-email}, and @option{--mailfrom}.
122These became deprecated in version 4.0. @xref{31x-400}.
123@end enumerate
124
125@end enumerate
126
127@node 43x-440
128@appendixsec Upgrading from 4.3.x to 4.4
129@cindex Upgrading from 4.3.x to 4.4
130
131 The deprecated @option{--domain} command line option has been
132withdrawn. The short option @option{-D} now defines a preprocessor
133symbol (@pxref{Preprocessor Options}).
134
135 This version correctly handles name clashes between constants and
136variables, which remained unnoticed in previous releases.
137@xref{variable--constant shadowing}, for a detailed description of it.
138
139 To minimize chances of name clashes, all symbolic exception codes has
140been renamed by prefixing them with the @samp{e_}, thus, e.g. @code{divzero}
141became @code{e_divzero}, etc. The @code{ioerr} exception code is renamed to
142@code{e_io}. @xref{status.mfh}, for a full list of the new exception codes.
143
144@cindex @code{OLD_EXCEPTION_CODES}, preprocessor symbol
145 For consistency, the following most often used codes are available without
146the @samp{e_} prefix: success, not_found, failure, temp_failure. This
147makes most existing user scripts suitable for use with version 4.4
148without any modification. If your script refers to any exception
149codes other than these four, you can still use it by defining a
150preprocessor symbol @code{OLD_EXCEPTION_CODES}, for example:
151
152@smallexample
153$ mailfromd -DOLD_EXCEPTION_CODES
154@end smallexample
155
156@node 420-43x
157@appendixsec Upgrading from 4.2 to 4.3.x
158@cindex Upgrading from 4.2 to 4.3.x
159@cindex @code{DEFAULT_SYSLOG_ASYNC}, @command{configure} variable
160
161 Upgrading from 4.2 to 4.3 or 4.3.1 does not require any changes to
162your configuration and scripts. The only notable change in these
163versions is the following:
164
165 The asynchronous syslog implementation was reported to malfunction
166on some systems (notably on Solaris), so this release does not enable
167it by default. The previous meaning of the @option{--enable-syslog-async}
168configuration option is also restored. Use this option in order to
169enable asynchronous syslog feature. To set default syslog
170implementation, use @code{DEFAULT_SYSLOG_ASYNC} configuration variable
171(@pxref{syslog-async}).
172
173The following deprecated features are removed:
174
175@enumerate
176@item @code{#pragma option ehlo} statement.
177
178It became deprecated in version 4.0. @xref{pragma-option-ehlo}.
179
180@item @code{#pragma option mailfrom} statement.
181
182It became deprecated in version 4.0. @xref{pragma-option-ehlo}.
183
184@item The @option{--config-file} command line option.
185
186It became deprecated in version 3.1. @xref{30x-31x}.
187
188@item Built-in exception codes in catch statements.
189
190They are deprecated since version 4.0. @xref{31x-400}.
191@end enumerate
192
193@node 410-420
194@appendixsec Upgrading from 4.1 to 4.2
195@cindex Upgrading from 4.1 to 4.2
196 Upgrading to this version does not require any special efforts. You
197can use your configuration files and filter scripts without any
198changes. The only difference worth noticing is that starting from this
199version @command{mailfromd} is always compiled with asynchronous
200syslog implementation. The @option{--enable-syslog-async}
201configuration file option is still available, but its meaning has
202changed: it sets the @emph{default} syslog implementation to use
203(@pxref{syslog-async}). Thus, it can be used the same way it was in
204previous versions. You can also select the syslog implementation at
205run time, see @ref{Logging and Debugging, --syslog-async option}, for
206more detailed information.
207
208@node 400-410
209@appendixsec Upgrading from 4.0 to 4.1
210@cindex Upgrading from 4.0 to 4.1
211
212 Upgrading to this version does not require any special efforts. You
213can use your configuration files and filter scripts without any changes.
214Notice only the following major differences between 4.1 and 4.0:
215
216@itemize @bullet
217@item Input files are preprocessed before compilation.
218@xref{Preprocessor}, for more information.
219
220@item There is a way to discern between a not-supplied optional
221parameter, and a supplied one, having null value (@pxref{defined}).
222
223@item The version 4.1 implements @code{sprintf} function
224(@pxref{String formatting}) and @code{printf} macro
225(@pxref{Preprocessor, printf}).
226
227@item Support for some obsolete features is withdrawn. These include:
228
229@enumerate 1
230@item
231Using @samp{&@var{code}} to specify exception codes
232@item
233Pragma options: @code{retry}, @code{io-retry}, and
234@code{connect-retry}.
235@end enumerate
236@end itemize
237
238@node 31x-400
239@appendixsec Upgrading from 3.1.x to 4.0
240@cindex upgrading from 3.1.x to 4.0
241
242 Before building this version, please re-read the chapter
243@xref{Building}, especially the section @ref{syslog-async, Using
244non-blocking syslog}.
245
246 Starting from the version 4.0, @acronym{MFL} no longer uses the
247predefined symbolic names for exception codes (previous versions used
248the @samp{&} prefix to dereference them). Instead, it relies on
249constants defined in the include file @file{status.mfh}
250(@pxref{status.mfh}).
251
252 However, the script files from 3.1 series will still work, but
253the following warning messages will be displayed:
254
255@smallexample
256Warning: obsolete constant form used: &failure
257Warning: remove leading '&' and include <status.mfh>
258
259Warning: Using built-in exception codes is deprecated
260Warning: Please include <status.mfh>
261@end smallexample
262
263@anchor{pragma-option-ehlo}
264 Another important difference is that pragmatic options @samp{ehlo}
265and @samp{mailfromd} are now deprecated, as well as their command line
266equivalents @option{--ehlo} and @option{--domain}. These options
267became superfluous after the introduction of @code{mailfrom_address}
268and @code{ehlo_domain} built-in variables. For compatibility with the
269previous versions, they are still supported by @command{mailfromd}
2704.0, but a warning message is issued if they are used:
271
272@smallexample
273@group
274warning: `#pragma option ehlo' is deprecated,
275 consider using `set ehlo_domain "domain.name"' instead
276@end group
277@end smallexample
278
279 To update your startup scripts for the new version follow these
280steps:
281
282@enumerate 1
283@item
284 Change @code{#pragma option mailfrom @var{value}} to
285@code{set mailfrom_address @var{value}}. Refer to
286@ref{mailfrom_address}, for a detailed discussion of this variable.
287
288@item
289 Change @code{#pragma option ehlo @var{value}} to
290@code{set ehlo_domain @var{value}}. Refer to
291@ref{ehlo_domain}, for a detailed discussion of this variable.
292
293@item
294 Include @file{status.mfh}. Add the following line to the top of
295your startup file:
296
297@smallexample
298#include_once <status.mfh>
299@end smallexample
300
301@item
302 Remove all instances of @samp{&} in front of the constants. You can
303use the following @command{sed} expression: @samp{s/&\([a-z]\)/\1/g}.
304
305@item
306 If your code uses any of the following functions: @code{hostname},
307@code{resolve}, @code{hasmx} or @code{ismx}, add the following line
308to the top of your script:
309
310@smallexample
311#require dns
312@end smallexample
313
314@xref{Modules}, for a detailed description of the module system.
315
316@item
317 Replace all occurrences of @code{next} with @code{pass}.
318
319@item
320 If your code uses function @code{match_cidr}, add the following line
321to the top of your script:
322
323@smallexample
324#require match_cidr
325@end smallexample
326
327@xref{Modules}, for a description of @acronym{MFL} module system.
328
329@end enumerate
330
331@node 30x-31x
332@appendixsec Upgrading from 3.0.x to 3.1
333@cindex upgrading from 3.0.x to 3.1
334
335@enumerate 1
336@item
337 The @command{mailfromd} binary no longer supports
338@option{--config-file} (@option{-c}) option. To use an alternative
339script file, give it as an argument, i.e. instead of:
340
341@smallexample
342$ @kbd{mailfromd --config-file @var{file.rc}}
343@end smallexample
344
345@noindent
346write:
347@smallexample
348$ @kbd{mailfromd @var{file.rc}}
349@end smallexample
350
351 For backward compatibility, the old style invocation still works but
352produces a warning message. However, if @command{mailfromd}
353encounters the @option{-c} option it will print a diagnostic message
354and exit immediately. This is because the semantics of this option
355will change in the future releases.
356
357@item
358 If a variable is declared implicitly within a function, it is
359created as automatic. This differs from the previous versions, where
360all variables were global. It is a common practice to use global
361variables to pass additional information between handlers (@xref{HELO
362Domain}, for an example of this approach). If your filter uses it,
363make sure the variable is declared as global. For example, this code:
364
365@float Figure, old-code
366@caption{Implicit declaration, old style}
367@smallexample
368prog helo
369do
370 # @r{Save the host name for further use}
371 set helohost $s
372done
373@end smallexample
374@end float
375
376@noindent
377has to be rewritten as follows:
378
379@float Figure, new-code
380@caption{Implicit declaration, new style}
381@smallexample
382set helohost ""
383
384prog helo
385do
386 # @r{Save the host name for further use}
387 set helohost $s
388done
389@end smallexample
390@end float
391
392@item
393 Starting from version 3.1 the function @code{dbmap} takes an
394optional third argument indicating whether or not to count the
395terminating null character in key (@pxref{dbmap}). If your startup
396script contained any calls to @code{dbmap}, change them as follows:
397
398@multitable @columnfractions 0.5 0.5
399@headitem in 3.0.x @tab in 3.1
400@item dbmap(@var{db}, @var{key}) @tab dbmap(@var{db}, @var{key}, 1)
401@end multitable
402
403@end enumerate
404
405
406@node 2x-30x
407@appendixsec Upgrading from 2.x to 3.0.x
408@cindex upgrading from 2.x to 3.0.x
409 Update your startup scripts and/or crontab entries. The
410@command{mailfromd} binary is now installed in @file{$@{prefix@}/sbin}.
411
412 We also encourage you to update the startup script (run
413@kbd{cp etc/rc.mailfromd /wherever-your-startup-lives}), since the new
414version contains lots of enhancements.
415
416@node 1x-2x
417@appendixsec Upgrading from 1.x to 2.x
418@cindex upgrading from 1.x to 2.x
419 If you are upgrading from version 1.x to 2.0, you will have to do
420the following:
421
422@enumerate 1
423@item
424Edit your script file and enclose the entire code section into:
425
426@smallexample
427@group
428prog envfrom
429do
430 @dots{}
431done
432@end group
433@end smallexample
434
435@noindent
436@xref{Handlers}, for more information about the @code{prog} statement.
437
438@item
439If your code contained any @code{rate} statements, convert them to
440function calls (@pxref{Rate limiting functions, rate}), using the
441following scheme:
442
443@smallexample
444@group
445Old statement: if rate @var{key} @var{limit} / @var{expr}
446New statement: if rate(@var{key}, interval("@var{expr}")) > @var{limit}
447@end group
448@end smallexample
449
450For example,
451@smallexample
452 rate $f 180 / 1 hour 25 minutes
453@end smallexample
454@noindent
455should become
456@smallexample
457 rate($f, interval("1 hour 25 minutes")) > 180
458@end smallexample
459
460@item
461Rebuild your databases using the following command:
462
463@smallexample
464mailfromd --compact --all
465@end smallexample
466
467@noindent
468This is necessary since the format of @command{mailfromd} databases
469has changed in version 2.0: the key field now includes the trailing
470@samp{NUL} character, which is also reflected in its length. This
471allows for empty (zero-length) keys. @xref{Database Maintenance}, for
472more information about the database compaction.
473@end enumerate
474
diff --git a/etc/mailfromd.rc b/etc/mailfromd.rc
index f25cfb3..e19cac4 100644
--- a/etc/mailfromd.rc
+++ b/etc/mailfromd.rc
@@ -1,6 +1,6 @@
1/* This is a sample filter for Mailfromd. -*- mfl -*- 1/* This is a sample filter for Mailfromd. -*- mfl -*-
2 Site administrators are urged to write nicer versions. 2 Site administrators are urged to write nicer versions.
3 Copyright (C) 2005, 2006, 2007, 2008 Sergey Poznyakoff 3 Copyright (C) 2005, 2006, 2007, 2008, 2009 Sergey Poznyakoff
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
@@ -24,14 +24,13 @@
24 24
25#include_once <status.mfh> 25#include_once <status.mfh>
26#require dns 26#require dns
27#require rateok
27 28
28set mailfrom_address "<>" 29set mailfrom_address "<>"
29set ehlo_domain "your.domain" 30set ehlo_domain "your.domain"
30 31
31number gltime 32number gltime interval("1 hour")
32set gltime interval("1 hour") 33number need_greylist 0
33number need_greylist
34set need_greylist 0
35 34
36func cachestr() returns string 35func cachestr() returns string
37do 36do
@@ -45,10 +44,12 @@ done
45prog envfrom 44prog envfrom
46do 45do
47 if $f = "" 46 if $f = ""
48 pass 47 pass
49 elif hostname ${client_addr} matches ".*(adsl|sdsl|hdsl|ldsl|dialin|dialup|ppp|dhcp|dynamic).*" 48 elif dbmap("/etc/mail/whitelist.db", $client_addr)
49 accept
50 elif hostname($client_addr) matches ".*(adsl|sdsl|hdsl|ldsl|dialin|dialup|ppp|dhcp|dynamic).*"
50 reject 550 5.7.1 "Use your SMTP relay" 51 reject 550 5.7.1 "Use your SMTP relay"
51 elif hostname ${client_addr} matches ".*-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}.*" 52 elif hostname($client_addr) matches ".*-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}.*"
52 on poll host ${client_addr} for $f 53 on poll host ${client_addr} for $f
53 do 54 do
54 when success: 55 when success:
@@ -58,7 +59,7 @@ do
58 when temp_failure: 59 when temp_failure:
59 tempfail 450 4.1.0 "Try again later" 60 tempfail 450 4.1.0 "Try again later"
60 done 61 done
61 elif relayed hostname ${client_addr} 62 elif relayed(hostname($client_addr))
62 pass 63 pass
63 elif $f mx fnmatches "*.yahoo.com" 64 elif $f mx fnmatches "*.yahoo.com"
64 or $f mx fnmatches "*.namaeserver.com" 65 or $f mx fnmatches "*.namaeserver.com"
@@ -74,7 +75,7 @@ do
74 done 75 done
75 fi 76 fi
76 77
77 if rate($f "-" ${client_addr}, interval("1 hour 30 minutes")) > 100 78 if not rateok($f "-" $client_addr, interval("1 hour 30 minutes"), 100)
78 tempfail 450 4.7.0 "Mail sending rate exceeded. Try again later" 79 tempfail 450 4.7.0 "Mail sending rate exceeded. Try again later"
79 fi 80 fi
80done 81done
@@ -82,15 +83,13 @@ done
82prog envrcpt 83prog envrcpt
83do 84do
84 if %need_greylist 85 if %need_greylist
85 and not dbmap("/var/run/whitelist.db", $client_addr)
86 if greylist($client_addr "-" $f "-" $rcpt_addr, %gltime) 86 if greylist($client_addr "-" $f "-" $rcpt_addr, %gltime)
87 if %greylist_seconds_left = %gltime 87 if %greylist_seconds_left = %gltime
88 tempfail 450 4.7.0 88 tempfail 450 4.7.0
89 "You are greylisted for " %gltime " seconds" 89 "You are greylisted for " %gltime " seconds"
90 else 90 else
91 tempfail 450 4.7.0 91 tempfail 450 4.7.0
92 "Still greylisted for " 92 "Still greylisted for " %greylist_seconds_left " seconds"
93 %greylist_seconds_left " seconds"
94 fi 93 fi
95 fi 94 fi
96 fi 95 fi
diff --git a/mfd/lex.l b/mfd/lex.l
index 40821b9..3ceabfc 100644
--- a/mfd/lex.l
+++ b/mfd/lex.l
@@ -174,7 +174,9 @@ WS [ \t][ \t]*
174IDENT [a-zA-Z_][a-zA-Z_0-9]* 174IDENT [a-zA-Z_][a-zA-Z_0-9]*
175LOCUS __file__|__line__|__function__ 175LOCUS __file__|__line__|__function__
176VCONST __package__|__version__|__major__|__minor__|__patch__ 176VCONST __package__|__version__|__major__|__minor__|__patch__
177ICONST {LOCUS}|{VCONST}|__statedir__|__preproc__ 177STATEDIR __(def)?statedir__
178 PREPROC __(def)?preproc__
179ICONST {LOCUS}|{VCONST}|{STATEDIR}|{PREPROC}
178%% 180%%
179 /* C-style comments */ 181 /* C-style comments */
180"/*" BEGIN_X(COMMENT); 182"/*" BEGIN_X(COMMENT);
@@ -826,6 +828,9 @@ builtin_const(const char *s)
826 yylval.number = MAILFROMD_VERSION_PATCH; 828 yylval.number = MAILFROMD_VERSION_PATCH;
827 return NUMBER; 829 return NUMBER;
828 } else if (strcmp(s, "__statedir__") == 0) { 830 } else if (strcmp(s, "__statedir__") == 0) {
831 string(mailfromd_state_dir, strlen(mailfromd_state_dir));
832 return STRING;
833 } else if (strcmp(s, "__defstatedir__") == 0) {
829 string(DEFAULT_STATE_DIR, sizeof DEFAULT_STATE_DIR - 1); 834 string(DEFAULT_STATE_DIR, sizeof DEFAULT_STATE_DIR - 1);
830 return STRING; 835 return STRING;
831 } else if (strcmp(s, "__preproc__") == 0) { 836 } else if (strcmp(s, "__preproc__") == 0) {
@@ -834,6 +839,13 @@ builtin_const(const char *s)
834 else 839 else
835 string(ext_pp, strlen(ext_pp)); 840 string(ext_pp, strlen(ext_pp));
836 return STRING; 841 return STRING;
842 } else if (strcmp(s, "__defpreproc__") == 0) {
843 if (DEFAULT_PREPROCESSOR)
844 string(DEFAULT_PREPROCESSOR,
845 sizeof DEFAULT_PREPROCESSOR - 1);
846 else
847 string("", 0);
848 return STRING;
837 } 849 }
838 abort(); 850 abort();
839} 851}

Return to:

Send suggestions and report system problems to the System administrator.